I have written a tool that aims to detect data races in java.
It reported the following, for lastBit field:
WARNING: ThreadSanitizer: data race (pid=14124)
Write of size 8 at 0x7fee81677238 by thread T9:
#0 avrora.sim.radio.Medium$Transmission.end() Medium.java:610
#1 avrora.sim.radio.Medium$Transmitter.endTransmit() Medium.java:210
#2 avrora.sim.radio.CC1000Radio$MainRegister.decode() CC1000Radio.java:277
#3 avrora.sim.radio.CC1000Radio$RadioRegister.write() CC1000Radio.java:217
#4 avrora.sim.radio.CC1000Radio$SerialConfigurationInterface.clockInBit() CC1000Radio.java:962
#5 avrora.sim.radio.CC1000Radio$SerialConfigurationInterface.access$200() CC1000Radio.java:885
#6 avrora.sim.radio.CC1000Radio$SerialConfigurationInterface$PCLKOutput.write() CC1000Radio.java:916
#7 avrora.sim.mcu.DefaultMCU$Pin.write() DefaultMCU.java:213
#8 avrora.sim.mcu.ATMegaFamily$PortRegister.write() ATMegaFamily.java:209
#9 avrora.sim.AtmelInterpreter$IORegBehavior.write() AtmelInterpreter.java:712
#10 avrora.sim.AtmelInterpreter.writeVolatile() AtmelInterpreter.java:751
#11 avrora.sim.AtmelInterpreter.writeSRAM() AtmelInterpreter.java:678
#12 avrora.sim.AtmelInterpreter.setIORegBit() AtmelInterpreter.java:636
#13 avrora.arch.legacy.LegacyInterpreter.visit() LegacyInterpreter.java:634
#14 avrora.arch.legacy.LegacyInstr$CBI.accept() LegacyInstr.java:1370
#15 avrora.arch.legacy.LegacyInterpreter.fastLoop() LegacyInterpreter.java:245
#16 avrora.arch.legacy.LegacyInterpreter.runLoop() LegacyInterpreter.java:79
#17 avrora.sim.AtmelInterpreter.start() AtmelInterpreter.java:378
#18 avrora.sim.Simulator.start() Simulator.java:531
#19 avrora.sim.SimulatorThread.run() SimulatorThread.java:98
Previous read of size 8 at 0x7fee81677238 by thread T8:
#0 avrora.sim.radio.Medium$Receiver.intersect() Medium.java:528
#1 avrora.sim.radio.Medium$Receiver.getIntersection() Medium.java:507
#2 avrora.sim.radio.Medium$Receiver.access$200() Medium.java:260
#3 avrora.sim.radio.Medium$Receiver$Ticker.deliverByte() Medium.java:374
#4 avrora.sim.radio.Medium$Receiver$Ticker.fireLocked() Medium.java:363
#5 avrora.sim.radio.Medium$Receiver$Ticker.fire() Medium.java:307
#6 avrora.sim.clock.DeltaQueue$Link.fire() DeltaQueue.java:123
#7 avrora.sim.clock.DeltaQueue.skipAhead() DeltaQueue.java:259
#8 avrora.sim.clock.MainClock.skipAhead() MainClock.java:118
#9 avrora.arch.legacy.LegacyInterpreter.sleepLoop() LegacyInterpreter.java:238
Apparently, there is a race between the read of lastBit here and a write here. There is no (known) synchronization mechanism protecting the accesses.
I have written a tool that aims to detect data races in java.
It reported the following, for lastBit field:
Apparently, there is a race between the read of lastBit here and a write here. There is no (known) synchronization mechanism protecting the accesses.