HiSPARC/station-software — Issue #2: Fix the Uploader to make sure it only sends events once
Author: 153957
Created: 2012-03-04 09:52:54+00:00
State: open

Currently the Uploader may try to upload new events to the Nikhef server and due to network problems not finish within 30 seconds, causing the upload to timeout. When a timeout occurs the Python script will try to upload the events again in the next batch. However in the background Windows might still be trying to upload the events, which may succeed, and because Python is no longer listening to the response it is unaware that it actually succeeded. This will cause duplicate events on the server.

Here are some possible solutions:
http://stackoverflow.com/questions/8037724/how-to-shutdown-a-timed-out-http-post-using-urlopen-by-urllib2-in-python

The preferred solution:
- Simply kill the upload process in case of a timeout, so that a timeout is indeed a timeout.
If multiple timeouts occur the batch size may need to be changed dynamically.

Other solutions may include server side scripts:
- The server collects a list hashes of received event batches, the client can check that list to see which events were successfully sent.
- Use a more robust send-response mechanism