When I create entities and add components in multiple threads, there are unforeseen concurrency issues · Issue #165 · dominion-dev/dominion-ecs-java · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When I create entities and add components in multiple threads, there are unforeseen concurrency issues #165
In my actual project, I create monster entities in a System. In order to take advantage of multi-core, I use parallelStream and create monster entities in it, and cache the Entity to Component, but I found that in the next System, the Entity in the Component obtained by the context.findEntitiesWith() method is different from the hashCode of ResultSet.entity()
when I call rs.entity().getId() in System, I found that the ID of Entity has many repetitions, and the chunkId in the ID still points to the old chunk.
hi, @enricostara
I found that this is a very troublesome concurrency issue. this issue may appear in the two methods of remove and copy. since remove will move the Item, the copied data may be wrong. I am not sure if this is the case, and I have not yet known how to fix this issue.
Hi, @enricostara
First of all I must thank you for your work.
Second, I run my project and my previous test code, they all work fine.
But I modified my test code and found some problems, I added unit test in IntEntity
Activity
endison1986 commentedon May 26, 2023
when I call
rs.entity().getId()in System, I found that the ID of Entity has many repetitions, and the chunkId in the ID still points to the old chunk.this is log
you will find many
4097and4098endison1986 commentedon Jun 12, 2023
hi, @enricostara
I found that this is a very troublesome concurrency issue. this issue may appear in the two methods of remove and copy. since remove will move the Item, the copied data may be wrong. I am not sure if this is the case, and I have not yet known how to fix this issue.
enricostara commentedon Jun 12, 2023
Hi @endison1986 ,
I'm still investigating this issue
Merge pull request #168 from dominion-dev/feature/meet_the_Fluorine_m…
enricostara commentedon Jun 19, 2023
Hi @endison1986 ,
please checkout and double-check if it works as expected.
In IntEntityTest I added a unit test derived from your example code
endison1986 commentedon Jun 20, 2023
Hi, @enricostara
First of all I must thank you for your work.
Second, I run my project and my previous test code, they all work fine.
But I modified my test code and found some problems, I added unit test in IntEntity
I get an error message
Merge pull request #170 from dominion-dev/feature/meet_the_Fluorine_m…
enricostara commentedon Jun 20, 2023
Hi @endison1986 ,
I added the new test and improved the code.
Please check again if It works as expected.
endison1986 commentedon Jun 21, 2023
Hi @enricostara , it all works fine in my project and test code, thanks.
enricostara commentedon Jun 21, 2023
Thanks you for your tests!