lhotari commented on issue #10433:
URL: https://github.com/apache/pulsar/issues/10433#issuecomment-828976205


   I wonder if something in this direction could be happening:
   
   Let's say we have 2 threads, T1 and T2 and a single object instance O1.
   
   1. T1 gets O1 from the pool
   2. T1 sets fields on O1
   3. T1 shares O1 to T2
   4. T2 set O1 fields to null and returns O1 to the pool
   5. T1 gets O1 from the pool
   6. T1 sets fields on O1
   7. **T2 reads O1 fields. The values that T1 set in step 6 aren't visible to 
T2. The visible values are the null values set in step 4.**
   
   I've been recently watching [Aleksey Shipilëv's Java Memory Model Unlearning 
Experience presentation](https://www.youtube.com/watch?v=TK-7GCCDF_I).
   
   In the presentation, [at about 21 minutes 50 
seconds](https://www.youtube.com/watch?v=TK-7GCCDF_I&t=21m50s), there's an 
interesting example:
   
![image](https://user-images.githubusercontent.com/66864/116509894-bb0e3f80-a8cc-11eb-9d02-981ac3e33732.png)
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to