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

segmentation fault #121

Open
pbiggar opened this issue Jun 3, 2015 · 8 comments
Open

segmentation fault #121

pbiggar opened this issue Jun 3, 2015 · 8 comments

Comments

@pbiggar
Copy link
Owner

pbiggar commented Jun 3, 2015

What steps will reproduce the problem?
1. svn checkout
2. compile
3. run phc

What is the expected output? What do you see instead?
not to have a segmentation fault

What version of the product are you using? On what operating system?
latest from svn with maketea from svn

Please provide any additional information below.

Centos-5.2 x86_64 on an openvz container. (openvz.org)
Boost lib 1.38, gperf, gengetopt, maketea.
Configured with: --with-php + --with-maketea

strace output:
..........................
................
........
fstat(3, {st_mode=S_IFREG|0755, st_size=245264, ...}) = 0
mmap(NULL, 2383168, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) =
0x2b10fd1da000
mprotect(0x2b10fd215000, 2097152, PROT_NONE) = 0
mmap(0x2b10fd415000, 4096, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3b000) = 0x2b10fd415000
mmap(0x2b10fd416000, 40256, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2b10fd416000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2b10fd420000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2b10fd421000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2b10fd422000
arch_prctl(ARCH_SET_FS, 0x2b10fd4225c0) = 0
mprotect(0x2b10fb7bd000, 4096, PROT_READ) = 0
mprotect(0x2b10fb5a4000, 4096, PROT_READ) = 0
mprotect(0x2b10fa12b000, 4096, PROT_READ) = 0
mprotect(0x2b10f9ce0000, 4096, PROT_READ) = 0
mprotect(0x2b10f9ad1000, 4096, PROT_READ) = 0
mprotect(0x2b10f98b2000, 16384, PROT_READ) = 0
mprotect(0x2b10f9355000, 4096, PROT_READ) = 0
mprotect(0x2b10f90b9000, 24576, PROT_READ) = 0
mprotect(0x2b10f8dd2000, 4096, PROT_READ) = 0
mprotect(0x2b10f7369000, 4096, PROT_READ) = 0
munmap(0x2b10f8012000, 33049)           = 0
set_tid_address(0x2b10fd422650)         = 30435
set_robust_list(0x2b10fd422660, 0x18)   = 0
futex(0x7fffb395b32c, FUTEX_WAKE_PRIVATE, 1) = -1 ENOSYS (Function not
implemented)
rt_sigaction(SIGRTMIN, {0x2b10f98c1370, [], SA_RESTORER|SA_SIGINFO,
0x2b10f98ca4c0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x2b10f98c12b0, [],
SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x2b10f98ca4c0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0
futex(0x2b10f90c3ca8, FUTEX_WAKE, 2147483647) = 0
access("/etc/selinux/", F_OK)           = 0
brk(0)                                  = 0x7427000
brk(0x7448000)                          = 0x7448000
open("/etc/selinux/config", O_RDONLY)   = -1 ENOENT (No such file or directory)
open("/proc/mounts", O_RDONLY)          = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2b10f8012000
read(3, "/dev/simfs / simfs rw 0 0\n/proc /proc proc rw 0 0\n/sys /sys
sysfs rw 0 0\nnone /dev tmpfs rw 0 0\nnone /dev/pts devpts rw 0 0\nnone
/proc/sys/fs/binfmt_misc binfmt_misc rw 0 0\n", 4096) = 173
read(3, "", 4096)                       = 0
close(3)                                = 0
munmap(0x2b10f8012000, 4096)            = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++


Original issue reported on code.google.com by anilcetin on 2009-04-24 14:47:15

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

Sorry forget to mention;
PHP 5.2.9: './configure'  '--with-libevent' '--enable-fastcgi'
'--enable-force-cgi-redirect' '--enable-discard-path' '--enable-sigchild' '--with-o
penssl' '--with-zlib' '--enable-bcmath' '--with-bz2' '--with-curl'
'--with-curlwrappers' '--enable-ftp' '--with-gd' '--with-ttf'
'--enable-gd-native-ttf' '--
enable-mbstring' '--with-mcrypt' '--with-mhash' '--with-mysql' '--with-mysqli'
'--enable-pcntl' '--enable-sockets' '--enable-zip' '--enable-maintainer-zts' '
--with-libdir=lib64' '--enable-embed' '--enable-static=yes'

Original issue reported on code.google.com by anilcetin on 2009-04-24 15:09:53

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

I have found the problematic thing: Boehm garbage collector! Compiled phc with
"--disable-gc" and there is no more segfaults.

Original issue reported on code.google.com by anilcetin on 2009-04-25 09:40:39

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

Hi,

Can you include a test case and the command line you used to call phc?

Original issue reported on code.google.com by paul.biggar on 2009-04-27 13:39:19

  • Labels added: Component-GC

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

If you need I can provide a ssh at virtual server with same conditions. Simply
compile it with garbage collector and just run /usr/local/lib/phc It will segfault.

Original issue reported on code.google.com by anilcetin on 2009-04-28 21:26:59

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

Can you provide a stack trace first? After installing phc (configured with -g in the
CFLAGS), run it through gdb, and run the backtrace command.

What configure command was passed to phc?

Also, can you test without the --enable-static=yes passed to PHP? I wonder if that's
a problem.

Original issue reported on code.google.com by paul.biggar on 2009-04-29 08:08:26

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

I have also experienced the same problem when dumping to AST in XML.
I was using cygwin and compiled successfully.

Finally I solved with increase the stack size to 16MB by using the following commnds:
export CFLAGS='-Wl,--stack,16777216'
export CXXFLAGS='-Wl,--stack,16777216'

Although the complication with the commands above will cause error in plugins complication,
but still able to make install as well as using it.

Original issue reported on code.google.com by schroys on 2010-11-22 05:34:04

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

Can you identify what takes so much stack space? Is it the recursion when traversing
the tree?

Can you excerpt the PHP code which it is processing when it segfaults?

Original issue reported on code.google.com by paul.biggar on 2010-11-22 11:38:18

@pbiggar
Copy link
Owner Author

pbiggar commented Jun 3, 2015

I can confirm the segfault (11) on darwin (OSX 10.7.4), and the solution, adding --disable-gc
to the configure options solves the segfault.

for the segfault I was not parsing any file I just ran the binary to make sure it worked
without any switched, though using --help would still cause the segfault.

Original issue reported on code.google.com by thesin on 2012-06-19 14:56:40

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

No branches or pull requests

1 participant