Skip to content

Adding a plugin with TH code causes segfault on linux #936

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

Closed
hamishmack opened this issue Apr 3, 2020 · 8 comments
Closed

Adding a plugin with TH code causes segfault on linux #936

hamishmack opened this issue Apr 3, 2020 · 8 comments

Comments

@hamishmack
Copy link

Here is a smallish example to reproduce the issue:

git clone https://github.com/hamishmack/plugin-test.git
nix-shell
./test.sh

Not sure why, but it seems not to crash on macOS.

GDB back trace (I'll try to get one with debug info)

(gdb) bt
#0  0x00007ffff320081c in s1tNrj_info () from /nix/store/xirww4ji37j6gbx7slb13n8qbpcysdck-ghc-8.6.5-lib-ghc/lib/x86_64-linux-ghc-8.6.5/libHSghc-8.6.5-EJczqCQztt0zzT7IjTfYb-ghc8.6.5.so
haskell/ghcide#1  0x0000000000000000 in ?? ()

strace output ends with

write(1, "Step 6/6: Type checking the file"..., 34Step 6/6: Type checking the files
) = 34
futex(0x109b7ec, FUTEX_WAIT_PRIVATE, 0, NULL) = 0
futex(0x109b7f0, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0x109b7f0, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x7f37e8236cc8, FUTEX_WAIT_PRIVATE, 2, NULL) = 0
futex(0x7f37e8236cc8, FUTEX_WAKE_PRIVATE, 1) = 0
mmap(NULL, 8392704, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f3759ffc000
mprotect(0x7f3759ffd000, 8388608, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7f375a7fbfb0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[7230], tls=0x7f375a7fc700, child_tidptr=0x7f375a7fc9d0) = 7230
openat(AT_FDCWD, "/proc/self/task/7230/comm", O_RDWR) = 71
write(71, "ghcide:w", 8               = 8
close(71)                               = 0
futex(0x109b7e8, FUTEX_WAIT_PRIVATE, 0, NULL) = ?
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)
@mpickering
Copy link
Contributor

@hamishmack Can you please update this issue with what you discovered about the effect of --enable-executable-dynamic?

@hamishmack
Copy link
Author

Switching off --enable-executable-dynamic on ghcide seems to fix the segfault.

I have added a flag to the test case here that can be used to switch --enable-executable-dynamic on and off.

@sloane-shark
Copy link

sloane-shark commented May 23, 2020

Any workarounds for this? Trying to make use of polysemy-plugin, which seems to trigger the same issue?

@fendor
Copy link
Collaborator

fendor commented May 23, 2020

I have been using ghcide with polysemy-plugin before, seems to be working for me

@cocreature
Copy link
Contributor

@matthewess Have you tried linking dynamically like @hamishmack suggested above?

@sloane-shark
Copy link

@cocreature should have mentioned, I’m using ghcide-nix so i believe id have to use the fork they used in their example. for now i’m just not using plugins

@jneira
Copy link
Member

jneira commented Oct 5, 2020

Not sure if haskell/ghcide#836 could help with this, @matthewess @hamishmack could you give a try?

@jneira
Copy link
Member

jneira commented Nov 24, 2020

will close this one optimistically in a few days

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

7 participants