Closed Bug 722575 Opened 8 years ago Closed 8 years ago
Record Consumer .java consumer Is Done() is not threadsafe
consumerIsDone() reads the counter variable in a non-threadsafe manner. This isn't a huge deal since the value is only used for logging purposes. Threads (T1, T2) T1 calls run() T1 obtains lock for monitor T1 calls consumerIsDone() T1 executes info() and checks for value of counter (let's say 0) T1 is context switched out before ?: executes T2 calls storeSerially() T2 obtains lock for storeSerializer T2 increments counter T2 is context switched out T1 finishes info call and logs "Consumer is done. Processed 0 records." since counter == 1 is now true  - https://github.com/mozilla-services/android-sync/blob/develop/src/main/java/org/mozilla/gecko/sync/synchronizer/SerialRecordConsumer.java#L133
(In reply to David Chan [:dchan] from comment #0) > This isn't a huge deal since the value is only used for logging purposes. Yup, that's why I left it for now :D Thanks for filing, though!
Priority: -- → P3
Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Whiteboard: [fixed in services][qa-]
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
Whiteboard: [fixed in services][qa-] → [qa-]
Product: Mozilla Services → Android Background Services
You need to log in before you can comment on or make changes to this bug.