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
Comments
Hi Cecil,
Someone has now created this as a NetLogo issue
#1830
Thank you for bringing up the issue, and including your system information.
In order to address this issue it would be helpful to have a reproducible example.
To do this you want to keep track of any random-seeds used.
In the BehaviorSpace doc it notes that
Variables can also include max-pxcor<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#max-pcor>, min-pxcor<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#min-pcor>, max-pycor<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#max-pcor> and min-pycor<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#min-pcor>, world-width<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#world-dim>, world-height<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#world-dim> and random-seed<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#random-seed>.
And that
Varying random-seed<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#random-seed> lets you repeat runs by using a known seed for the NetLogo random number generator. Note that you’re also free to use the random-seed<https://ccl.northwestern.edu/netlogo/docs/dictionary.html#random-seed> command in your experiment’s setup commands. For more information on random seeds, see the Random Numbers<https://ccl.northwestern.edu/netlogo/docs/programming.html#random-numbers> section of the Programming Guide.
See
https://ccl.northwestern.edu/netlogo/docs/behaviorspace.html
The following section of the Programming manual might be helpful.
https://ccl.northwestern.edu/netlogo/docs/programming.html#random-numbers
[do this before code with randomness is run, perhaps in setup]
let my-seed new-seed
random-seed my-seed
[ some code to write my-seed to a file with date or run information ]
The functions used above are described in
https://ccl.northwestern.edu/netlogo/docs/dictionary.html#new-seed
https://ccl.northwestern.edu/netlogo/docs/dictionary.html#random-seed
If you set and save your random-seed values, when the exception occurs you will be able to use them to create a model that reproduces the problem.
Once you share a reproducible model, we will be able to investigate.
Thanks,
Aaron
By the way
I looked a bit at the code in your stack trace.
The problem begins on the NetLogo side when an object is being added to a LogoList by the LogoListBuilder add method.
However since we have neither the current LogoList, nor the object being added, this can’t help us understand the problem.
However the LogoList may be needed for internal bookkeeping, so it makes sense that the problem could happen without outputting the data to a file.
After that the code moves to Vector, which is part of Scala.
Vector is a general-purpose, immutable data structure, backed by a bit-mapped vector tree.
It uses a lot of bit masking and bit shifting to decide where to add data.
It fails in the method gotoNextBlockStartWritable(index: Int, xor: Int) because some bit-shifted value is not in any anticipated range.
This must be caused by some rare circumstance because I think it would be a known issue by now, and I didn’t find anything in
https://github.com/scala/bug/issues
Vector is a general-purpose, immutable data structure.
…--
Aaron Brandes, Software Developer
Center for Connected Learning and Computer-Based Modeling
From: Cecil BN <notifications@github.com>
Reply-To: NetLogo/NetLogo <reply@reply.github.com>
Date: Thursday, April 2, 2020 at 12:58 AM
To: NetLogo/NetLogo <NetLogo@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: [NetLogo/NetLogo] Uncertain Cause of IllegalArgumentException (#1830)
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).
`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
`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/issues/1830__;!!Dq0X2DkFhyF93HkjWTBQKhk!G_IRJWJ0CjkMB7UWsj6uTVXvmHhlPmaxSmshL2Dxmg01nmfi4DHiTsK2Xp2jbyzmykCdd8OCcQ$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANSUO2ST37S4X4WIJFADALLRKQLNXANCNFSM4LZ6MIBA__;!!Dq0X2DkFhyF93HkjWTBQKhk!G_IRJWJ0CjkMB7UWsj6uTVXvmHhlPmaxSmshL2Dxmg01nmfi4DHiTsK2Xp2jbyzmykA-K4dJ5g$>.
|
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. |
Hi Cecil,
It appears that your code is using the NetLogo primitive n-values. n-values takes two arguments, a size and a reporter. It is quite possible that the reporter is generating a random number.
Many NetLogo primitives that compute random numbers are in the NetLogo Dictionary, starting with the entry
https://ccl.northwestern.edu/netlogo/docs/dictionary.html#random
You should be able to locate any places in your code using n-values. Then you can output (to a file is probably best) values indicating the state of your program before and after the call to n-values.
My tips for creating a reproducible version of the problem remain relevant.
To go further I see two possible routes:
1. You or someone on your team build a version of NetLogo and debug some of the underlying code. [ We can point you to on line guidance]
2. You make a simplified version of your code that does all of the same random computations, but leaves out other steps you can’t share.
Let me know if we can help you further.
* Aaron
…--
Aaron Brandes, Software Developer
Center for Connected Learning and Computer-Based Modeling
From: Cecil BN <notifications@github.com>
Reply-To: NetLogo/NetLogo <reply@reply.github.com>
Date: Thursday, April 2, 2020 at 11:22 PM
To: NetLogo/NetLogo <NetLogo@noreply.github.com>
Cc: Aaron Andre Brandes <aaron.brandes@northwestern.edu>, Comment <comment@noreply.github.com>
Subject: Re: [NetLogo/NetLogo] Uncertain Cause of IllegalArgumentException (#1830)
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.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/issues/1830*issuecomment-608207783__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!BHR6LS38rTGZXmX0k7dQkOnSTbXnSNvgft_va8i3sl1iQGsC1ea2-qiASdtmtVHcgBiK_WfSvw$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANSUO2WJUM7VKTA65TA6JQLRKVI4NANCNFSM4LZ6MIBA__;!!Dq0X2DkFhyF93HkjWTBQKhk!BHR6LS38rTGZXmX0k7dQkOnSTbXnSNvgft_va8i3sl1iQGsC1ea2-qiASdtmtVHcgBi0Q1GCow$>.
|
Hi Cecil,
A colleague suggested that the problem could be due to running low on memory.
If you are doing parallel runs, can you check whether the problem occurs without this option, as the use of parallel runs increases the memory requirements of the program.
https://ccl.northwestern.edu/netlogo/docs/behaviorspace.html#run-options-parallel-runs
Also, doing parallel runs could complicate the process of creating a reproducible model.
* Aaron
…--
Aaron Brandes, Software Developer
Center for Connected Learning and Computer-Based Modeling
From: Cecil BN <notifications@github.com>
Reply-To: NetLogo/NetLogo <reply@reply.github.com>
Date: Thursday, April 2, 2020 at 11:22 PM
To: NetLogo/NetLogo <NetLogo@noreply.github.com>
Cc: Aaron Andre Brandes <aaron.brandes@northwestern.edu>, Comment <comment@noreply.github.com>
Subject: Re: [NetLogo/NetLogo] Uncertain Cause of IllegalArgumentException (#1830)
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.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/NetLogo/NetLogo/issues/1830*issuecomment-608207783__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!BHR6LS38rTGZXmX0k7dQkOnSTbXnSNvgft_va8i3sl1iQGsC1ea2-qiASdtmtVHcgBiK_WfSvw$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/ANSUO2WJUM7VKTA65TA6JQLRKVI4NANCNFSM4LZ6MIBA__;!!Dq0X2DkFhyF93HkjWTBQKhk!BHR6LS38rTGZXmX0k7dQkOnSTbXnSNvgft_va8i3sl1iQGsC1ea2-qiASdtmtVHcgBi0Q1GCow$>.
|
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! |
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 |
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. |
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. |
I appreciate you updating this issue with your resolution!
There is a known issue for NetLogo lists (backed by Scala's vector) growing too large giving an |
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
`
The text was updated successfully, but these errors were encountered: