View Revisions: Issue #863

Summary 0000863: Prevent race condition for read/write of savapage.json
Revision 2017-09-08 20:34 by rijkr
Description IST: Sometimes, a "com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input in field name" is encountered when reading a user's savapage.json file. This indicates that the file is incomplete, which could be due to a read/write "race condition". For example, after a PDF upload, the UserEventService gets a notification from the Linux file system of the newly created PDF, and immediately reads the PDF meta data from the savapage.json file, while at the same time the same json file is being written by another thread.
SOLL: Create savapage.json as temp file and do atomic move to target location.
NOTE: This issue was observed on VMware with an extra mounted disk (XFS File System) dedicated for temporary files and user inboxes.
Revision 2017-09-08 20:11 by rijkr
Description IST: Sometimes, a "com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input in field name" is encountered when reading a user's savapage.json file. This indicates that the file is incomplete, which could be due to a read/write "race condition". For example, after a PDF upload, the UserEventService gets a notification from the Linux file system of the newly created PDF, and immediately reads the PDF meta data from the savapage.json file, while at the same time the same json file is being written by another thread.

SOLL: Create savapage.json as temp file and do atomic move to target location.

NOTE: This issue was observed on VMware with an extra mounted disk (XFS File System) dedicated for temporary files and user inboxes.
Revision 2017-09-08 19:34 by rijkr
Description IST: Sometimes, a "com.fasterxml.jackson.core.JsonParseException: Unexpected end-of-input in field name" is encountered when reading a user's savapage.json file. This indicates that the file is incomplete, which could be due to a read/write "race condition". For example, after a PDF upload, the UserEventService gets a notification from the Linux file system of the newly created PDF, and immediately reads the PDF meta data from the savapage.json file, while at the same time the same json file is being written by another thread.

SOLL: Create savapage.json as temp file and do atomic move to target location.

NOTE: This issue was observed on VMware with an extra mounted disk (XFS File System) dedicated for temporary files and user inboxes. On the same system it was also observed that an atomic file move sometimes fails, due to the fact that the source file is reported missing, although a Java File.exists(), just before the move, reports that the file is present.