Control pipelines: crash when converting empty reading to operation
FlorentP42 opened this issue · comments
FlorentP42 commented
Describe the bug
When exiting a control pipeline, if the reading does not contain any value, the dispatcher will crash with the following stack trace:
Fledge dispatcher[1741]: FATAL: Signal 11 (Segmentation fault) trapped:
Fledge dispatcher[1741]: FATAL: (0) 0 0x5628b82807d2 handler(int) + 82---------
Fledge dispatcher[1741]: FATAL: (1) 1 0x7fcbb5b31090 /lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7fcbb5b31090]---------
Fledge dispatcher[1741]: FATAL: (2) 2 0x5628b82de657 PipelineExecutionContext::filter(Reading*) + 311---------
Fledge dispatcher[1741]: FATAL: (3) 3 0x5628b827f5da ControlOperationRequest::filter(ControlPipelineManager*) + 202---------
Fledge dispatcher[1741]: FATAL: (4) 4 0x5628b827f841 ControlOperationServiceRequest::execute(DispatcherService*) + 65---------
Fledge dispatcher[1741]: FATAL: (5) 5 0x5628b82bb623 DispatcherService::worker() + 35---------
Fledge dispatcher[1741]: FATAL: (6) 6 0x7fcbb5dd3df4 /lib/x86_64-linux-gnu/libstdc++.so.6(+0xd6df4) [0x7fcbb5dd3df4]---------
Fledge dispatcher[1741]: FATAL: (7) 7 0x7fcbb634c609 /lib/x86_64-linux-gnu/libpthread.so.0(+0x8609) [0x7fcbb634c609]---------
Fledge dispatcher[1741]: FATAL: (8) 8 0x7fcbb5c0d133 clone + 67---------
To Reproduce
Steps to reproduce the behavior:
- Create a north service that can call an operation "TestOP" containing one parameter "type".
- Create a south service that can receive an operation "TestOP" with 0 parameters that prints a log when receiving an operation.
- Create a control pipeline between those services.
- Add a filter to this pipeline that will remove the paramters from any operation it process and log the resulting reading.
- Restart Fledge so that the pipeline becomes active.
- Call the "TestOP" operation from the north plugin.
- In the log from the filter, notice that the properly removed:
{"asset_code":"TestOP","user_ts":"2023-12-04 14:38:07.746647+00:00","ts":"2023-12-04 14:38:07.746647+00:00","reading":{}}
- Notice the crash before the operation could reach the south plugin.
Expected behavior
The reading is properly converted into an operation with 0 parameters.
Additional context
N/A
FlorentP42 commented
Duplicate of fledge-iot/fledge-service-dispatcher#52