You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a potential DivideByZeroException in the FairQueueing class of NetMQ when all pipes become deactivated (m_active becomes zero). This exception occurs specifically in the RecvPipe method during the modulo operation used for round-robin scheduling of the pipes.
Steps to Reproduce
Create a scenario where all pipes are systematically deactivated, setting m_active to zero.
Continue to receive messages or perform operations that lead to the modulo operation (m_current = (m_current + 1) % m_active).
Expected Behavior
The system should handle situations where m_active is zero without throwing a DivideByZeroException, possibly by skipping the modulo operation when no active pipes are available.
Actual Behavior
The system throws a DivideByZeroException when trying to perform the modulo operation with m_active set to zero due to all pipes being deactivated.
Proposed Solution
To prevent this issue, the modulo operation in the RecvPipe method should be conditionally performed only when m_active is greater than zero. Here is the suggested change:
netmq/src/NetMQ/Core/Patterns/Utils/FairQueueing.cs
Line 125 in 97da3b4
Description
There is a potential
DivideByZeroException
in theFairQueueing
class of NetMQ when all pipes become deactivated (m_active
becomes zero). This exception occurs specifically in theRecvPipe
method during the modulo operation used for round-robin scheduling of the pipes.Steps to Reproduce
m_active
to zero.m_current = (m_current + 1) % m_active
).Expected Behavior
The system should handle situations where
m_active
is zero without throwing aDivideByZeroException
, possibly by skipping the modulo operation when no active pipes are available.Actual Behavior
The system throws a
DivideByZeroException
when trying to perform the modulo operation withm_active
set to zero due to all pipes being deactivated.Proposed Solution
To prevent this issue, the modulo operation in the
RecvPipe
method should be conditionally performed only whenm_active
is greater than zero. Here is the suggested change:The text was updated successfully, but these errors were encountered: