Skip to content

Commit 90984db

Browse files
kofemannmksahakyan
authored andcommitted
cells: fix race condition between thread start and flag check
Motivation: If newly started thread runs before `running` flag is set, then tunnel with shutdown instantly. Thread-1: Create T2 --> | T2.start() | --> set running flag Thread-2: | check flag; exit | Modification: set `running` before thread starts. Result: race is fixed Issue: #5326 Acked-by: Paul Millar Target: master, 10.2 Require-book: no Require-notes: yes (cherry picked from commit 2440b22) Signed-off-by: Tigran Mkrtchyan <[email protected]>
1 parent 4ea4d6f commit 90984db

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/cells/src/main/java/dmg/cells/network/LocationManagerConnector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public LocationManagerConnector(String cellName, String args, SocketFactory sock
5454
@Override
5555
protected void started() {
5656
_thread = getNucleus().newThread(this, "TunnelConnector-" + _domain);
57-
_thread.start();
5857
_isRunning = true;
58+
_thread.start();
5959
}
6060

6161
private StreamEngine connect()

0 commit comments

Comments
 (0)