Skip to content

modbus_send_rtu while(spin_lock); causing infinite loop. #932

Description

@andrewmarles

I found an issue where modbus_send_rtu would get stuck on waiting for the spin lock when it was called in the context of

packet->callbacks.on_rx_exception(ModBus_CRCError, packet->msg.context);

This seemed to be related to having two sources calling modbus_send in rapid succession (Modbus RGB plugin and VFD plugin). I was able to work around it by releasing the spinlock around the callback, but I'm not sure this is the best solution:

spin_lock = false;
packet->callbacks.on_rx_exception(ModBus_CRCError, packet->msg.context);
spin_lock = true;

I have also put the same unlock around the rx_timeout callback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions