[QFJ-135] session -> setResponder not thread safe Created: 07/Feb/07 Updated: 11/Feb/09 Resolved: 15/Feb/07 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | Engine |
Affects Version/s: | 1.0.5 |
Fix Version/s: | 1.0.5 |
Type: | Bug | Priority: | Minor |
Reporter: | Christopher Hurst | Assignee: | Steve Bate |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Environment: |
Windows / Unix |
Description |
setResponder is not synchronized (responder not volatile) and called from a different thread to hasResponder. Although hasResponder is synchronized and will get the latest version from main memory dropping its thread cache , there is no obvious guarantee that the thread calling setResponder has hit a memory barrier and forced its new responder value to main memory so hasResponder method can return an unexpected result as it will get the latest one from memory but not from the other threads cache that may not have been pushed to main memory yet. change setResponder to be synchronized. public synchronized void setResponder(Responder responder) |