Tangerine-Community / Tangerine

Digitize your offline data collection. Create your Forms online with Tangerine Editor, conduct them offline with the Tangerine Android App. All results you collect can be exported as a CSV file, easy for processing in a spreadsheet. Tangerine has been used in over 1 million assessments and surveys in over 60 countries and in 100 languages.
http://www.tangerinecentral.org/
GNU General Public License v3.0
49 stars 29 forks source link

When server crashed, /paid-worker-state.json was empty #1955

Open chrisekelley opened 4 years ago

chrisekelley commented 4 years ago

Current version: v3.4.0

Issue on tablet and/or server:

server - Sierra Leone

This caused a JSON.parse error in runPaidWorker when express-app ran keepAlivePaidWorker.

Fix: I modified /paid-worker-state.json to be {}. Note that the dockerfile creates it as {}.

Possible cause: Server ran out of disk space. Does runPaidWorker first clear /paid-worker-state.json before modifying it? When runPaidWorker tried to update /paid-worker-state.json, it must have been unable to modify the file.

rjcorwin commented 4 years ago

@lachko Closing this for now. This is good to know about. When servers run out of space, paid-worker-state.json might be blank.

chrisekelley commented 2 years ago

Update: Error happened on Sante Mali server:

[4:31 PM] Kelley, Chris
2022-05-20T21:31:18.687Z ERROR /tangerine/server/src/express-app.js:611:11 Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at /tangerine/server/src/paid-worker.js:21:27
at Generator.next (<anonymous>)
at fulfilled (/tangerine/server/src/paid-worker.js:4:58)
chrisekelley commented 2 years ago

Suggest making this code more resilient - at the very least, catch error and reset /paid-worker-state.json to be {}