Giter Club home page Giter Club logo

Comments (3)

ralphlange avatar ralphlange commented on June 3, 2024

The segfault happens as part of updating internal structures in a callback function supplied by my code to the SDK, when the SDK signals the completion of a read request.
Somehow the array of the values provided to the callback seems to have invalid data (or the array is only partial?) so that assigning the status code that I get as an argument in the callback to a local variable segfaults.

That could match a situation, where a read request (possibly the read request done on all items after the connection comes up) times out. The session gets the callback that the connection status changed to WatchdogTimeout and then the read completion callback (of the read that timed out) is called with missing or zero values.

Since I have not seen this WatchdogTimeout status and don’t know how to produce it, I have not tested that situation.
(Adding tests using mock versions of the SDK classes is on my list, but that’s not trivial and not done yet.)

That part of the code has changed for 0.6 and will again for 0.7, so I am not really inclined to further investigate… of course, invalid values in the read completion callback could still create some havoc. I will add simple consistency checks in 0.7 – I was always assuming data coming up from the SDK to be sane, but that might not be the case, after all.

from opcua.

ralphlange avatar ralphlange commented on June 3, 2024

Console log:

efe358d.mpsid-i.4087 > OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from Connected to ConnectionErrorApiReconnect
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from ConnectionErrorApiReconnect to NewSessionCreated
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from NewSessionCreated to Connected
OPC UA session MPSoS:Ctrl-IOC-01:Mag: (readBatchOfNodes) beginRead service ok (transaction id 3; retrieving 309 nodes)
Session MPSoS:Ctrl-IOC-01:Mag: (readComplete) getting data for read service (transaction id 3; data for 309 items)
Session MPSoS:Ctrl-IOC-01:Mag: (requestWrite) beginWrite service ok (transaction id 4; writing 1 nodes)
Session MPSoS:Ctrl-IOC-01:Mag: (writeComplete) getting results for write service (transaction id 4; results for 1 items)
OPC UA session MPSoS:Ctrl-IOC-01:VAC: connection status changed from Connected to ConnectionWarningWatchdogTimeout
OPC UA session MPSoS:Ctrl-IOC-01:VAC: connection status changed from ConnectionWarningWatchdogTimeout to Connected
OPC UA session MPSoS:Ctrl-IOC-01:VAC: (readBatchOfNodes) beginRead service ok (transaction id 3; retrieving 357 nodes)
Session MPSoS:Ctrl-IOC-01:VAC: (readComplete) getting data for read service (transaction id 3; data for 357 items)
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from Connected to ConnectionWarningWatchdogTimeout
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from ConnectionWarningWatchdogTimeout to Connected
OPC UA session MPSoS:Ctrl-IOC-01:Mag: (readBatchOfNodes) beginRead service ok (transaction id 5; retrieving 309 nodes)
Session MPSoS:Ctrl-IOC-01:Mag: (readComplete) getting data for read service (transaction id 5; data for 309 items)
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from Connected to ConnectionWarningWatchdogTimeout
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from ConnectionWarningWatchdogTimeout to Connected
OPC UA session MPSoS:Ctrl-IOC-01:Mag: (readBatchOfNodes) beginRead service ok (transaction id 6; retrieving 309 nodes)
Session MPSoS:Ctrl-IOC-01:Mag: (readComplete) getting data for read service (transaction id 6; data for 0 items)
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from Connected to ConnectionWarningWatchdogTimeout
/home/iocuser/epics/base-7.0.3/require/3.1.1/bin/iocsh.bash: line 145:  4102 Segmentation fault      (core dumped) ${__CHRT__}${EPICS_BASE}/bin/${EPICS_HOST_ARCH}/softIoc${__PVA__} -D ${EPICS_BASE}/dbd/softIoc${__PVA__}.dbd "${IOC_STARTUP}" 2>&1

from opcua.

ralphlange avatar ralphlange commented on June 3, 2024

Two issues:

Extraneous initial read() operation

The transition WatchdogTimeout to Connected triggers the initial read() of all items. That is wrong, as the server never went away.

Segfault on empty read() reply

A service request that gets an empty answer because of a server side issue

OPC UA session MPSoS:Ctrl-IOC-01:Mag: (readBatchOfNodes) beginRead service ok (transaction id 6; retrieving 309 nodes)
Session MPSoS:Ctrl-IOC-01:Mag: (readComplete) getting data for read service (transaction id 6; data for 0 items)
OPC UA session MPSoS:Ctrl-IOC-01:Mag: connection status changed from Connected to ConnectionWarningWatchdogTimeout
/home/iocuser/epics/base-7.0.3/require/3.1.1/bin/iocsh.bash: line 145:  4102 Segmentation fault      (core dumped)

causes the client to segfault. That's a bug, which needs to be fixed by checking consistency between request and reply.

from opcua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.