Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running examples/browse.go returns EOF error #550

Closed
Opsi opened this issue Jan 24, 2022 · 1 comment · Fixed by #683
Closed

Running examples/browse.go returns EOF error #550

Opsi opened this issue Jan 24, 2022 · 1 comment · Fixed by #683
Milestone

Comments

@Opsi
Copy link

Opsi commented Jan 24, 2022

I was trying to run the browse.go example against my Prosys OPC UA Simulation Server as well as a running production server and every time I get an EOF error. I usually start the browsing at the root node "i=84", but using the id of a FolderType node resulted in the same outcome. I also tried to run on a linux machine as well as my mac m1. The io.EOF err is returned whenever the code reaches this line of the browse code for the second time. After using a debugger it seems like the EOF error is created by this line in the secure channel code.

This is the corresponding debug output:

debug: uacp: connecting to opc.tcp://<SERVER-ADDRESS>
debug: uacp 1: start HEL/ACK handshake
debug: uacp 1: sent HELF with 84 bytes
debug: uacp 1: recv ACKF with 28 bytes
debug: uacp 1: server has no chunk limit. Using 512
debug: uacp 1: server has no message size limit. Using 2097152
debug: uacp 1: recv &uacp.Acknowledge{Version:0x0, ReceiveBufSize:0x2004, SendBufSize:0x2004, MaxMessageSize:0x200000, MaxChunkCount:0x200}
debug: uasc 1/1: send *ua.OpenSecureChannelRequest with 132 bytes
debug: uacp 1: recv OPNF with 135 bytes
debug: uasc 1/1: recv OPNF with 135 bytes
debug: uasc 1/1: recv *ua.OpenSecureChannelResponse
debug: uasc 1/1: sending *ua.OpenSecureChannelResponse to handler
debug: uasc 1: received security token. channelID=398608 tokenID=1 createdAt=2022-01-24T12:54:13Z lifetime=1h0m0s
debug: uasc 1/2: send *ua.CreateSessionRequest with 291 bytes
debug: uasc 1: security token expires at 2022-01-24T14:09:13Z. channelID=398608 tokenID=1
debug: uasc 1: security token is refreshed at 2022-01-24T13:39:11Z (45m0s). channelID=398608 tokenID=1
debug: uacp 1: recv MSGC with 7075 bytes
debug: uasc 1/2: recv MSGC with 7075 bytes
debug: uacp 1: recv MSGC with 7075 bytes
debug: uasc 1/2: recv MSGC with 7075 bytes
debug: uacp 1: recv MSGF with 7075 bytes
debug: uasc 1/2: recv MSGF with 7075 bytes
debug: uasc 1/2: recv *ua.CreateSessionResponse
debug: uasc 1/2: sending *ua.CreateSessionResponse to handler
debug: uasc 1/3: send *ua.ActivateSessionRequest with 149 bytes
debug: uacp 1: recv MSGF with 96 bytes
debug: uasc 1/3: recv MSGF with 96 bytes
debug: uasc 1/3: recv *ua.ActivateSessionResponse
debug: uasc 1/3: sending *ua.ActivateSessionResponse to handler
debug: uasc 1/4: send *ua.ReadRequest with 131 bytes
debug: sub: pause
debug: client: monitor: start
debug: uacp 1: recv MSGF with 427 bytes
debug: uasc 1/4: recv MSGF with 427 bytes
debug: uasc 1/4: recv *ua.ReadResponse
debug: uasc 1/4: sending *ua.ReadResponse to handler
debug: uasc 1/5: send *ua.ReadRequest with 190 bytes
debug: uacp 1: recv MSGF with 93 bytes
debug: uasc 1/5: recv MSGF with 93 bytes
debug: uasc 1/5: recv *ua.ReadResponse
debug: uasc 1/5: sending *ua.ReadResponse to handler
debug: uasc 1/6: send *ua.BrowseRequest with 138 bytes
debug: uacp 1: recv MSGF with 72 bytes
debug: uasc 1/6: recv MSGF with 72 bytes
debug: uasc 1/6: recv *ua.BrowseResponse
debug: uasc 1/6: sending *ua.BrowseResponse to handler
debug: uasc 1/7: send *ua.BrowseRequest with 138 bytes
debug: uacp 1: recv MSGF with 196 bytes
debug: uasc 1/7: recv MSGF with 196 bytes
debug: uasc 1/7: recv *ua.BrowseResponse
debug: uasc 1/7: sending *ua.BrowseResponse to handler
debug: uasc 1/8: send *ua.ReadRequest with 190 bytes
debug: uacp 1: recv ERRF with 101 bytes
debug: uasc 1: readChunk EOF
opcua: browse children: EOF
exit status 1

I also created a corresponding Stackoverflow-Issue

@Opsi
Copy link
Author

Opsi commented Jan 25, 2022

Progress on the issue:

  • Browse and BrowseWithContext return a ua.BrowseResponse
  • The NodeID from ua.BrowseResponse.Results[*].References[*].NodeID.NodeID have a NodeIDType of 64 (I'm unsure why)
  • 64 is an invalid NodeIDType
  • The next Browse or Read uses this NodeIDType=64 and the Server returns an error "Bad_DecodingError (code=0x80070000, description=\"Unexpected NodeId Encoding Byte 64\")" (Found with Breakpoint conn.go#L377)
  • Then this error is hidden behind an EOF in secure_channel.go#L343 because len(b) == 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants