Skip to content

Serial collisions cause LS240 to respond with garbage and crashes the agent #418

@BrianJKoopman

Description

@BrianJKoopman

If multiple programs try to communicate with the 240, junk might be sent back when the agent is querying the sensors. This junk then can't be cast to float here:

return float(response)

This causes the acq process to crash. We should catch these instances and log the error, but just move onto the next iteration of the loop and continue querying.

Here are some examples:

2023-02-22T23:53:34+0000 startup-op: launching init_lakeshore
2023-02-22T23:53:34+0000 start called for init_lakeshore
2023-02-22T23:53:34+0000 init_lakeshore:0 Status is now "starting".
2023-02-22T23:53:34+0000 init_lakeshore:0 Status is now "starting".
2023-02-22T23:53:34+0000 attempt 0
2023-02-22T23:53:34+0000 Initialized Lakeshore module: Lake Shore Model 240-2P          (LSA21OT)
2023-02-22T23:53:34+0000 start called for acq
2023-02-22T23:53:34+0000 init_lakeshore:0 Lakeshore initialized with ID: LSA21OT
2023-02-22T23:53:34+0000 acq:1 Status is now "starting".
2023-02-22T23:53:34+0000 init_lakeshore:0 Lakeshore module initialized.
2023-02-22T23:53:34+0000 init_lakeshore:0 Status is now "done".
2023-02-22T23:53:34+0000 acq:1 Status is now "running".
2023-02-23T05:34:52+0000 acq:1 CRASH: [Failure instance: Traceback: <class 'ValueError'>: could not convert string to float: '0292.4\r+00.5789'
/usr/lib/python3.8/threading.py:932:_bootstrap_inner
/usr/lib/python3.8/threading.py:870:run
/usr/local/lib/python3.8/dist-packages/twisted/_threads/_threadworker.py:47:work
/usr/local/lib/python3.8/dist-packages/twisted/_threads/_team.py:182:doWork
--- <exception caught here> ---
/usr/local/lib/python3.8/dist-packages/twisted/python/threadpool.py:244:inContext
/usr/local/lib/python3.8/dist-packages/twisted/python/threadpool.py:260:<lambda>
/usr/local/lib/python3.8/dist-packages/twisted/python/context.py:117:callWithContext
/usr/local/lib/python3.8/dist-packages/twisted/python/context.py:82:callWithContext
/usr/local/lib/python3.8/dist-packages/socs/agents/lakeshore240/agent.py:221:acq
/usr/local/lib/python3.8/dist-packages/socs/Lakeshore/Lakeshore240.py:337:get_reading
]
2023-02-22T23:00:16+0000 startup-op: launching init_lakeshore
2023-02-22T23:00:16+0000 start called for init_lakeshore
2023-02-22T23:00:16+0000 init_lakeshore:0 Status is now "starting".
2023-02-22T23:00:16+0000 init_lakeshore:0 Status is now "starting".
2023-02-22T23:00:16+0000 attempt 0
2023-02-22T23:00:16+0000 Initialized Lakeshore module: Lake Shore Model 240-2P          (LSA21OT)
2023-02-22T23:00:16+0000 start called for acq
2023-02-22T23:00:16+0000 init_lakeshore:0 Lakeshore initialized with ID: LSA21OT
2023-02-22T23:00:16+0000 acq:1 Status is now "starting".
2023-02-22T23:00:16+0000 init_lakeshore:0 Lakeshore module initialized.
2023-02-22T23:00:16+0000 init_lakeshore:0 Status is now "done".
2023-02-22T23:00:16+0000 acq:1 Status is now "running".
2023-02-22T23:06:57+0000 acq:1 CRASH: [Failure instance: Traceback: <class 'ValueError'>: could not convert string to float: 'D-670S-.L,6SN  235000,\r+0.00000'
/usr/lib/python3.8/threading.py:932:_bootstrap_inner
/usr/lib/python3.8/threading.py:870:run
/usr/local/lib/python3.8/dist-packages/twisted/_threads/_threadworker.py:47:work
/usr/local/lib/python3.8/dist-packages/twisted/_threads/_team.py:182:doWork
--- <exception caught here> ---
/usr/local/lib/python3.8/dist-packages/twisted/python/threadpool.py:244:inContext
/usr/local/lib/python3.8/dist-packages/twisted/python/threadpool.py:260:<lambda>
/usr/local/lib/python3.8/dist-packages/twisted/python/context.py:117:callWithContext
/usr/local/lib/python3.8/dist-packages/twisted/python/context.py:82:callWithContext
/usr/local/lib/python3.8/dist-packages/socs/agents/lakeshore240/agent.py:221:acq
/usr/local/lib/python3.8/dist-packages/socs/Lakeshore/Lakeshore240.py:337:get_reading
]
2023-02-22T23:06:57+0000 acq:1 Status is now "done".
2023-02-22T23:53:13+0000 Received SIGTERM, shutting down.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions