mqtt_write() fails when calling io_sprint()
Writing a sample with mqtt_write()
leads to a crash caused by io_sprint()
called at mqtt.cpp:529.
Error message:
14:53:56 info default: MQTT: Node broker(mqtt) connected to broker localhost
14:53:56 info default: MQTT: Node broker(mqtt) subscribed to broker localhost
state = 1
villas-node: /villasnode/lib/io.cpp:516: int io_sprint(io*, char*, size_t, size_t*, sample**, unsigned int): Assertion `io->state == State::CHECKED || io->state == State::OPENED' failed.
Aborted (core dumped)
As shown by the additional debug message state = 1
, current state seems to be INITIALIZED
.
I assume this is a result of the call of io_init()
in mqtt_start()
@mqtt.cpp:397.
Manually setting the state to CHECKED
(m->io.state=State::CHECKED
) after the call of io_init()
seems to fix the problem, but I don't think this is the proper way.
Is this error introduced or related to ffa57f5e?