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

Uncertain Cause of IllegalArgumentException #1830

Closed
Friend-of-Ollie opened this issue Apr 2, 2020 · 9 comments
Closed

Uncertain Cause of IllegalArgumentException #1830

Friend-of-Ollie opened this issue Apr 2, 2020 · 9 comments

Comments

@Friend-of-Ollie
Copy link

Friend-of-Ollie commented Apr 2, 2020

Hello,

I'm using Netlogo for research and my model is throwing IllegalArgumentException errors at me during Behaviourspace runs. I'm having a hard time decoding the error message (my Java is quite rusty), could anyone help shed some light on what the probable cause(s) might be?

This isn't consistently thrown every run (there's several random distributions being used so that's plausible as to why), and I think it only occurs during writing the values of Behaviorspace reporters to file (sheet). (EDIT: I have run a Behaviorspace set with no reporters and it still happens, so I've probably jumped to the wrong conclusion)

`java.lang.IllegalArgumentException
at scala.collection.immutable.VectorPointer.gotoNextBlockStartWritable(Vector.scala:873)
at scala.collection.immutable.VectorPointer.gotoNextBlockStartWritable$(Vector.scala:831)
at scala.collection.immutable.VectorBuilder.gotoNextBlockStartWritable(Vector.scala:639)
at scala.collection.immutable.VectorBuilder.$plus$eq(Vector.scala:653)
at org.nlogo.api.LogoListBuilder.add(LogoListBuilder.scala:12)
at org.nlogo.prim.etc._nvalues.$anonfun$report$1(_nvalues.scala:23)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:158)
at org.nlogo.prim.etc._nvalues.report(_nvalues.scala:22)
at org.nlogo.prim.etc._nvalues.report(_nvalues.scala:9)
at org.nlogo.prim._asm_procedurerandombinomial_report_0.perform()
at org.nlogo.nvm.Context.callReporterProcedure(Context.java:254)
at org.nlogo.prim._asm_procedurezonespread_let_65.perform(:2)
at org.nlogo.nvm.Context.runExclusive(Context.java:133)
at org.nlogo.nvm.ExclusiveJob.run(ExclusiveJob.scala:39)
at org.nlogo.nvm.Context.runExclusiveJob(Context.java:177)
at org.nlogo.prim._asm_procedurezonespread_ask_14.perform(:1)
at org.nlogo.nvm.Context.runExclusive(Context.java:133)
at org.nlogo.nvm.ExclusiveJob.run(ExclusiveJob.scala:39)
at org.nlogo.nvm.Context.runExclusiveJob(Context.java:177)
at org.nlogo.prim._asm_procedurezonespread_ask_1.perform(:1)
at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.util.control.Exception$Catch.apply(Exception.scala:228)
at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:66)

NetLogo 6.1.1
main: org.nlogo.app.AppFrame
thread: AWT-EventQueue-0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_202 (Oracle Corporation; 1.8.0_202-b08)
operating system: Windows Server 2016 10.0 (amd64 processor)
Scala version 2.12.8
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: ENABLE-Facility_B-2_02-50cm

11:37:55.899 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.678 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.662 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.599 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.522 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.443 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.428 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.287 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.271 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
11:37:54.271 OutputEvent (org.nlogo.app.App$$anon$4 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
`

@brandesNW
Copy link
Contributor

brandesNW commented Apr 2, 2020 via email

@Friend-of-Ollie
Copy link
Author

Thank you for the advice Aaron, I'm afraid I'm not allowed to share the model code as it's being used for research purposes in a university lab and has to stay within its proverbial "four walls" at the moment.

Is it possible that _asm_procedurerandombinomial_report_0 is referring to bad output from the procedure random-binomial? (does at it says on the tin)

If there's a way to get a line-number out of the stack trace that corresponds to my model that would already be a huge leap towards identifying the problem on my side.

@brandesNW
Copy link
Contributor

brandesNW commented Apr 3, 2020 via email

@brandesNW
Copy link
Contributor

brandesNW commented Apr 3, 2020 via email

@Friend-of-Ollie
Copy link
Author

Friend-of-Ollie commented Apr 6, 2020

Thank you all for the advice, after several experiments and discussions I have managed to solve the issue indirectly (ie the model solves the objective in a different manner that doesn't cause this any more).

I had given Netlogo quite a lot of RAM to work with as per the instructions, but while running 28 parallel runs may have eaten too much of it. Regardless, it appears the conditions we are now using require fewer ticks to achieve so the IllegalArgumentException doesn't occur anymore.

My model looks into bacterial contamination spreading between agents, based on what I've seen I think the number of cells per agent were simply reaching ridiculously high levels when left for too long (I'm not 100% on that, but it's the closest hypothesis I have).

Anyway, for now the problem appears to have been solved, so once again thanks for the help!

@SethTisue
Copy link
Collaborator

Whatever the problem was here, note that it's entirely possible it's fixed in Scala 2.13 (ticket on upgrading is #1823), perhaps by scala/scala#6425, or in the forthcoming Scala 2.13.2 by scala/scala#8534

@Friend-of-Ollie
Copy link
Author

Thanks, we're in the middle of investigating it but it appears to be related to a procedure generating a non-integer n value for a random-binomial function, so not as deeply systemic as initially thought and on the way to being properly confirmed/fixed.

@Friend-of-Ollie
Copy link
Author

Hi all,

I believe I have figured out the problem, or at least an issue that is most likely closely related to it. After some more recent modifications we realised random-binomial was no longer going to work with the number of times it was being called and we have since then moved to a more straightforward n*p type of calculation. Due to how the random-binomial was being calculated I believe this instance of the problem was caused by generating an n-length vector of 1s and 0s (and then calculating the sum of said vector to get the result) that exceeded the maximum possible size of a Netlogo vector (if not that then some kind of similarly related issue).

I'm not sure how helpful this is to the Netlogo community in general, though it for me it does mean I have a more easily visible limitation to work around and I thought I would leave some kind of update after getting to the light at the end of the tunnel.

@LaCuneta
Copy link
Contributor

I appreciate you updating this issue with your resolution!

Due to how the random-binomial was being calculated I believe this instance of the problem was caused by generating an n-length vector of 1s and 0s (and then calculating the sum of said vector to get the result) that exceeded the maximum possible size of a Netlogo vector (if not that then some kind of similarly related issue).

There is a known issue for NetLogo lists (backed by Scala's vector) growing too large giving an IllegalArgumentException, so this is very possibly the case: #1686

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants