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

Segfault with ucontext on Mac OS with Clang and GCC #184

Closed
francoisk opened this issue Aug 11, 2021 · 7 comments
Closed

Segfault with ucontext on Mac OS with Clang and GCC #184

francoisk opened this issue Aug 11, 2021 · 7 comments

Comments

@francoisk
Copy link

All of the examples I tried (examples/fiber/fibonacci, for one) segfault on Mac OS with Clang and GCC if Context is built using ucontext.

The tested configurations are:

  • Mac OS 10.15, Clang 11.0
  • Mac OS 11, Clang 11.1 and 12
  • Mac OS 11, GCC 11.1

These configurations were tested under a different build system (which I ported to myself) but I did test the Boost build on Mac OS 11 with Clang 12 and had the same results. The Fibonacci example produced the correct output on Linux, FreeBSD, and Windows under the ported build.

The build commands I used are:

  b2 toolset=clang cxxflags='-std=c++11' --with-context context-impl=ucontext stage
  cd libs/context/examples/fiber
  b2 toolset=clang cxxflags='-std=c++11' context-impl=ucontext
@olk
Copy link
Member

olk commented Aug 11, 2021

Don't own a MacOS system - without a stack trace I can't do anything.

@francoisk
Copy link
Author

Hope this helps. On Mac OS 11 with Clang 12.0:

* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10040458e)
  * frame #0: 0x00007fff2013cc94 libsystem_malloc.dylib`tiny_free_list_add_ptr + 122
    frame #1: 0x00007fff2013a3ff libsystem_malloc.dylib`tiny_malloc_from_free_list + 1632
    frame #2: 0x00007fff2013981d libsystem_malloc.dylib`tiny_malloc_should_clear + 233
    frame #3: 0x00007fff20138727 libsystem_malloc.dylib`szone_malloc_should_clear + 66
    frame #4: 0x00007fff20151fe5 libsystem_malloc.dylib`_malloc_zone_malloc + 118
    frame #5: 0x00007fff2032940d libdyld.dylib`_tlv_atexit + 172
    frame #6: 0x0000000100006a18 fibonacci`boost::context::detail::fiber_activation_record::current() at fiber.cpp:48:5
    frame #7: 0x00000001000049d9 fibonacci`boost::context::detail::fiber_activation_record::resume(this=0x0000000100170f00) at fiber_ucontext.hpp:131:10
    frame #8: 0x0000000100004755 fibonacci`boost::context::fiber::resume(this=0x00007ffeefbff900) && at fiber_ucontext.hpp:471:83
    frame #9: 0x000000010000457a fibonacci`main at fibonacci.cpp:30:27
    frame #10: 0x00007fff2032bf5d libdyld.dylib`start + 1

@olk
Copy link
Member

olk commented Oct 7, 2021

no idea, I don't have access to a Mac system so I can't debug it

@boris-kolpackov
Copy link

We can organize an interactive CI session (i.e., a VNC or SSH login) if you would like to debug this.

@elfprince13
Copy link

I'm wondering if this is related to #198.

@eduardvoronkin
Copy link
Contributor

here I've addressed the problem #213

@olk
Copy link
Member

olk commented Dec 17, 2022

should be fixed by "fix ucontext for MacOS #213 "

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

5 participants