Socket.Send freeze under load ?
Posted: Fri May 07, 2010 12:19 pm
Hello,
I am trying to use this wonderful library to build a simple windows service that receives delivery receipts and inserts them into a database.
I am testing the service using the smppsim application available here:
http://www.seleniumsoftware.com/
I use a simple script to send 1000 messages with bind as transmitter and registered_delivery = 1, and then I bind with the service as receiver and test stability under load (with the simulator).
What consistently happens is that after approximately 600 messages, suddenly the event stops getting fired, and when I try to call unbind from another thread, nothing happens.
I drilled down and found the issue that the following stack:

consistently appears in each time, Socket.Send never returns.
I inspected the bytes and saw that it is never returning from sending the DeliverSmResp PDU.
The issue is reproducible with the demo application as well. Send 1000 messages or so to the simulator and the connect the demo app in receiver mode (on localhost) and it will stop responding after 500-600 messages on my machine. (Windows 7, Core 2 Duo P8600).
What is the best practice for gracefully shutting down when under load ?
When I call unbind() from another thread while the events are being fired, this induces the freeze as well.
Any feedback ? Is this some kind of synchronization issue ? Deadlock ?
I am trying to use this wonderful library to build a simple windows service that receives delivery receipts and inserts them into a database.
I am testing the service using the smppsim application available here:
http://www.seleniumsoftware.com/
I use a simple script to send 1000 messages with bind as transmitter and registered_delivery = 1, and then I bind with the service as receiver and test stability under load (with the simulator).
What consistently happens is that after approximately 600 messages, suddenly the event stops getting fired, and when I try to call unbind from another thread, nothing happens.
I drilled down and found the issue that the following stack:

consistently appears in each time, Socket.Send never returns.
I inspected the bytes and saw that it is never returning from sending the DeliverSmResp PDU.
The issue is reproducible with the demo application as well. Send 1000 messages or so to the simulator and the connect the demo app in receiver mode (on localhost) and it will stop responding after 500-600 messages on my machine. (Windows 7, Core 2 Duo P8600).
What is the best practice for gracefully shutting down when under load ?
When I call unbind() from another thread while the events are being fired, this induces the freeze as well.
Any feedback ? Is this some kind of synchronization issue ? Deadlock ?