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

KaSim runtime error: Index out of bounds | segmentation fault #325

Closed
hmedina opened this issue Dec 16, 2016 · 6 comments
Closed

KaSim runtime error: Index out of bounds | segmentation fault #325

hmedina opened this issue Dec 16, 2016 · 6 comments

Comments

@hmedina
Copy link
Collaborator

hmedina commented Dec 16, 2016

I'm running into a KaSim runtime error. However, I can't replicate it with a specific seed. A sample output:

+ Self seeding...
+ Command line to rerun is: 'KaSim' '-p' '0' '-i' 'results/2016_12_16-18_49_57/2/0.ka' '-o' 'results/2016_12_16-18_49_57/2/0.csv' -seed 506062246
Parsing results/2016_12_16-18_49_57/2/0.ka...
done
+ Sanity checks
+ Compiling...
+ Building initial simulation conditions...
         -simulation parameters
         -variable declarations
         -rules
         -perturbations
         -observables
         -update_domain construction
         34 (sub)observables 8 navigation steps
         -initial conditions
+ Building initial state
Done
____________________________________________________________

***Runtime error index out of bounds***


If I run 100 randomly seeded, I see failure within 30 repetitions (often as little as 2).

If I run 100 simulations using a seed I saw fail, I run into segmentation fault as well, even though most of the runs ran well:

$ for i in {1..100}; do KaSim -seed 615886366 -p 0 -i results/2016_12_16-18_49_57/2/0.ka -d foo -mode batch; done > stdout
Segmentation fault
Segmentation fault
Segmentation fault

***Runtime error index out of bounds***

Segmentation fault
Segmentation fault
Segmentation fault

In other words, out of 100 KaSim runs with the same seed, 93 finished correctly, 6 got runtime errors, 1 got a segfault. KaSim nightly 1edbeae

@pirbo
Copy link
Member

pirbo commented Jan 3, 2017

That is super hyper weird.
Are you using windows nightly build of KaSim throw cygwin?

@hmedina
Copy link
Collaborator Author

hmedina commented Jan 4, 2017

I used both Cygwin's mintty - bash and the regular cmd.exe, and both produced comparable results.

I'm now using the Linux subsystem for Windows, with native compiled KaSim, and the issue has not presented itself. I suspect "the cross-compiler was in a bad mood", again.

@pirbo
Copy link
Member

pirbo commented Jan 6, 2017

I think we'll have to give up on using the cross compiler from linux to produce windows binaries ... Too bad

@pirbo pirbo closed this as completed Jan 6, 2017
@hmedina
Copy link
Collaborator Author

hmedina commented Jan 6, 2017

Wait! The plot thickens; I must be doing something wrong on my python side; putting the below code in test.py:

#! python.exe
import subprocess
subprocess.run('bash.exe -c "~/KaSim/bin/KaSim --version"', check=True)

If I run it within PyCharm I get errors (notice this time is a new error code, for which the top result was a nodejs thing, but at this point that may be Google biasing results...):

Traceback (most recent call last):
  File "C:/cygwin64/home/Hector/KaSaAn/kappa_models/test.py", line 3, in <module>
     subprocess.run('bash.exe -c "~/KaSim/bin/KaSim --version"', check=True)
  File "C:\Program Files\Python\WinPython-64bit-3.5.2.2Qt5\python-3.5.2.amd64\lib\subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'bash.exe -c "~/KaSim/bin/KaSim --version"' returned non-zero exit status 4294967295

But if I run it through cmd.exe it works fine:
capture

Given that this is very similar behavior to the other error code, with an executable that was compiled for linux and is running within the linux subsystem, I suspect the issue is not the cross-compiler's mood. Either way, the issue should be closed until more testing reveals a lead...

@pirbo
Copy link
Member

pirbo commented Jan 6, 2017

subprocess.run('bash.exe -c "~/KaSim/bin/KaSim --version"', check=True)

does not work on my machine either (but I have a clearer No such file or directory error).
Either

subprocess.run(['/home/pirbo/KaSim/bin/KaSim', '--version'], check=True)

or

subprocess.run('~/KaSim/bin/KaSim --version', check=True,shell=True)

do.

@hmedina
Copy link
Collaborator Author

hmedina commented Jan 6, 2017

Since I'm compiling KaSim under the Linux Subsystem for Windows (LSW), it is not a Windows executable (i.e. not KaSim.exe). I have to call it through the LSW terminal, bash.exe in this case, to have it handle all the metadata that Linux files use that Windows files don't (more here), hence the command I send to cmd.exe is bash.exe -c "KaSim ..."

In the original post however, I was calling KaSimNightly directly from cygwin's bash, no python involved, and the issue was present (see the for i in {1..100}; do KaSim [...] part). Therefore it is not a python problem. 🤔

Calling KaSimLSW through LSW's bash does not present the problem (albeit, different commit), so it /may/ be a cross-compilation, or Cygwin interaction issue. In any case, the issue is not present when using the LSW directly.

capture-01

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

No branches or pull requests

2 participants