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

Seg fault in test suite on sink particle creation #94

Closed
mlombart opened this issue Nov 30, 2020 · 5 comments · Fixed by #132
Closed

Seg fault in test suite on sink particle creation #94

mlombart opened this issue Nov 30, 2020 · 5 comments · Fixed by #132
Assignees
Labels
bug Something isn't working

Comments

@mlombart
Copy link
Contributor

mlombart commented Nov 30, 2020

I do not know if other people have the same issue, but the testsuite does not pass with the last version of gfortran 10.2.0.
I have got this error:
`--> testing sink particle creation (sin)

s t r e t c h m a p p i n g <<<<<<
stretching to match density profile in r direction
density at r = 0.0000000000000000 is 1.0000000000000000
total mass = 6.9604063530626938E-004

Program received signal SIGBUS: Access to an undefined portion of a memory object.

Backtrace for this error:
/bin/bash: line 1: 90091 Segmentation fault: 11 ../bin/phantomtest
make[1]: *** [test] Error 139
make: *** [test] Error 2`

@danieljprice
Copy link
Owner

thanks for posting this. There is a problem with the way memory is allocated in the sink particle creation routine. I think the seg fault occurs if your stack size is not big enough, so there is a workaround (and hence why it is not failing in the GitHub actions). However, the underlying issue needs fixing, namely that a large array is allocated on the stack in create_ptmass (src/main/ptmass.F90, subroutine create_ptmass):

integer :: listneigh(maxneigh)

this needs to be an array that is globally allocated/deallocated, rather than getting repeatedly reallocated and deallocated every time one enters or leaves this subroutine.

@danieljprice danieljprice changed the title TEST Seg fault in test suite on sink particle creation Nov 30, 2020
@danieljprice danieljprice added the bug Something isn't working label Nov 30, 2020
@danieljprice danieljprice self-assigned this Nov 30, 2020
@danieljprice
Copy link
Owner

the workaround is that you need:

ulimit -s unlimited

@e-tejeda
Copy link

e-tejeda commented Mar 8, 2021

Hi! I seem to have run onto the same issue. I've just cloned the latest version of phantom in github and tried running the test suite.
This is the error that I get:

--> testing sink particle creation (sin)
>>>>> s t r e t c h m a p p i n g <<<<<<
stretching to match density profile in r direction
density at r = 0.0000000000000000 is 1.0000000000000000
total mass = 6.9604063530626938E-004
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
...
make[1]: *** [Makefile:2797: test] Segmentation fault (core dumped)
make[1]: Leaving directory '/home/emilio/phantom/build'
make: *** [Makefile:17: test] Error 2

The same error appears when I try to setup a polytropic star.
I've tried the workaround suggested by @danieljprice (ulimit -s unlimited) but the error persists.

@StephaneMichoulier
Copy link
Contributor

Same problem for me.
The workaround didn't work for me because the command ulimit -s unlimited is not accepted on MacOS.
ulimit: stack size: cannot modify limit: Operation not permitted

@danieljprice
Copy link
Owner

workaround on Mac OS is:

ulimit -s 8192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants