Stream management concurrency


Occasionally the Smack integration tests follow, logging an error like this: "You acknowledged stanzas that we didn't send. Your Ack h: X, our last stanza: Y" where X and Y are the same value. When X and Y are equal, then that's expected behavior and an error should not be logged.

When adding a synchronized block around the detection of the problem and the logging of the problem (which each retrieve the latest value of Y), the logging is correct: X and Y are different.

This leads me to believe that there's a concurrency related issue in the processing of Acks of Stream Management.

Not only should the synchronization described above be applied, but a similar synchronization should be applied when writing data out to the client, and updating the counter of unack'ed stanzas. Without such synchronization, the write could, theoretically, result in an ack, even before the unack'ed stanza was registered. Timing wise, this would be very unlikely given that one flow involves networking, but given that the Smack integration tests run in a virtual environment, where networking is all localhost, who knows...




Guus der Kinderen


Guus der Kinderen