I assumed with the synchronized sender this would not have been possible.
01/31/2023, 10:23 AM
that’s correct. if you correctly synchronize the access then it should not be possible. are you sure your synchronized all places where you access the sender? the snippet you shared - is this the only place touching the Sender?
01/31/2023, 10:28 AM
There are 2 places, both wrapped exactly like this. I'm puzzled as well and it's hard to debug as it happens infrequently. As you've confirmed I'm not doing anything too foolish I will keep investigating. Thanks.
01/31/2023, 10:36 AM
your code looks OK, I don’t see anything incorrect. the whole interaction with the Sender is guarded by a mutex. that’s akin to a single threaded access.
01/31/2023, 10:40 AM
Thanks for looking, I found the problem, it was my bug. I thought the trade.gets() were doing a simple native value fetch that couldn't go wrong. Turns out those gets can fail and when they do they leave the previous send incomplete. Thanks again.