Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP Server And Client Example model give ConcurrentModificationException #3334

Closed
hqnghi88 opened this issue Mar 22, 2022 · 2 comments
Closed
Assignees
Labels
About Models Library This issue or request concerns the models shipped with GAMA About Networking Concerns the network plugin and all network-related activities in GAMA 👍 Fix to be tested V. 1.8.2 Bug specific to 1.8.2

Comments

@hqnghi88
Copy link
Member

To Reproduce
Steps to reproduce the behavior:

  1. Go to Plugins models \Network\2 Available protocols\TCP protocol\TCP Server And Client Example .gaml
  2. Launch experiment.
  3. See error
    2 occurrences in 2 agents at cycle 1: Java error: ConcurrentModificationException
    in write (name + ' received : ') + mm.contents color: color ;
    ConcurrentModificationException: null
    java.base/java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1486)
    java.base/java.util.TreeMap$KeyIterator.next(TreeMap.java:1540)
    com.thoughtworks.xstream.core.util.PrioritizedList$PrioritizedItemIterator.next(PrioritizedList.java:91)
    com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:73)
    com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:472)
    com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:56)
    com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    when applying the contents operator on ummisco.gama.network.common.CompositeGamaMessage@7b6c7db2
    in write (name + ' received : ') + mm.contents color: color ;
    in loop while: self.has_more_message() {
    message mm <- self.fetch_message();
    write (name + ' received : ') + mm.contents color: color ;
    }

in reflex receive when: self.has_more_message() {
loop while: self.has_more_message() {
message mm <- self.fetch_message();
write (name + ' received : ') + mm.contents color: color ;
}

}

in agents Server0, Simulation 0

However the TCP Teleportation still works well.

Expected behavior
No error

gama git 1.8.2, win 11

@hqnghi88 hqnghi88 added About Models Library This issue or request concerns the models shipped with GAMA About Networking Concerns the network plugin and all network-related activities in GAMA V. 1.8.2 Bug specific to 1.8.2 labels Mar 22, 2022
@AlexisDrogoul AlexisDrogoul added this to the GAMA 1.8.2 milestone Mar 23, 2022
hqnghi88 added a commit that referenced this issue Apr 5, 2022
@hqnghi88
Copy link
Member Author

hqnghi88 commented Apr 5, 2022

@AlexisDrogoul @gnoubi @benoitgaudou i tried a solution that provide the xstream by class, for thread safe. It seems to work, but i tested only network model, not the serialized Experiment. So it require a clear review and reimplementation as Alexis said in #3288 " one instance per agent / model / message sending/receiving,"

@benoitgaudou
Copy link
Contributor

tested and seems to work. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
About Models Library This issue or request concerns the models shipped with GAMA About Networking Concerns the network plugin and all network-related activities in GAMA 👍 Fix to be tested V. 1.8.2 Bug specific to 1.8.2
Projects
None yet
Development

No branches or pull requests

4 participants