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

exec-port stops responding sometimes. #180

Open
kape1395 opened this issue Aug 5, 2024 · 5 comments
Open

exec-port stops responding sometimes. #180

kape1395 opened this issue Aug 5, 2024 · 5 comments

Comments

@kape1395
Copy link
Contributor

kape1395 commented Aug 5, 2024

erlexec sometimes stops to respond. Not sure if it is related to this problem, but sometimes I see segfaults in the syslog (Debian/bullseye, Erlang/OTP 22):

... kernel: [10024684.056118] exec-port[262130]: segfault at 1a ip 00007fb6573ccdb4 sp 00007fff9a7ef338 error 4 in libstdc++.so.6.0.28[7fb6573a7000+dc000]
... kernel: [10024684.056126] Code: 1f 80 00 00 00 00 48 8b 47 18 48 85 c0 74 17 0f 1f 80 00 00 00 00 49 89 c0 48 8b 40 10 48 85 c0 75 f4 4c 89 c0 c3 48 8b 47 08 <48> 3b 78 18 75 1f 66 0f 1f 44 00 00 49 89 c0 48 8b 40 08 4c 39 40

I understand the report is not very informative. I will try to debug it further, but any hints would help.

@saleyn
Copy link
Owner

saleyn commented Aug 5, 2024

Can you upgrade the OTP to 27 and reproduce it there? You may need to compile a non-optimized build in order to see the stacktrace by setting OPTIMIZE=false make.

@kape1395
Copy link
Contributor Author

kape1395 commented Aug 5, 2024

Upgrading OTP is not easy there. I will try to run this with OPTIMIZE=false make and valgrind enabled.
Do you think that might be related to the OTP version?
The failures happen now once a day or a week, and I can't find a way yet to reproduce them reliably.

@saleyn
Copy link
Owner

saleyn commented Aug 5, 2024

Not sure. It has been running pretty stably in many uses.

@kape1395
Copy link
Contributor Author

kape1395 commented Aug 7, 2024

That's the valgrind's memory detector output.
Unfortunately, I still don't have the Erlexec debug output; it was not written to a file.

==401359== Memcheck, a memory error detector
==401359== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==401359== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==401359== Command: /.../lib/erlexec-2.0.6/priv/x86_64-linux-gnu/exec-port
==401359== Parent PID: 401339
==401359==
==403175== Syscall param ioctl(TCSET{S,SW,SF}) points to uninitialised byte(s)
==403175==    at 0x4C77850: tcsetattr (tcsetattr.c:83)
==403175==    by 0x119440: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:568)
==403175==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==403175==    by 0x10D5B9: main (exec.cpp:291)
==403175==  Address 0x1ffefff6f0 is on thread 1's stack
==403175==  in frame #0, created by tcsetattr (tcsetattr.c:45)
==403175==
==403175== Conditional jump or move depends on uninitialised value(s)
==403175==    at 0x1195A3: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:581)
==403175==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==403175==    by 0x10D5B9: main (exec.cpp:291)
==403175==
==404561== Syscall param ioctl(TCSET{S,SW,SF}) points to uninitialised byte(s)
==404561==    at 0x4C77850: tcsetattr (tcsetattr.c:83)
==404561==    by 0x119440: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:568)
==404561==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==404561==    by 0x10D5B9: main (exec.cpp:291)
==404561==  Address 0x1ffefff6f0 is on thread 1's stack
==404561==  in frame #0, created by tcsetattr (tcsetattr.c:45)
==404561==
==404561== Conditional jump or move depends on uninitialised value(s)
==404561==    at 0x1195A3: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:581)
==404561==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==404561==    by 0x10D5B9: main (exec.cpp:291)
==404561==
==404561== Conditional jump or move depends on uninitialised value(s)
==404561==    at 0x1195AC: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:581)
==404561==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==404561==    by 0x10D5B9: main (exec.cpp:291)
==404561==
==404561== Syscall param ioctl(TIOCSWINSZ) points to uninitialised byte(s)
==404561==    at 0x4C78277: ioctl (syscall-template.S:120)
==404561==    by 0x1145C4: ei::set_winsz(int, int, int) (exec_impl.cpp:182)
==404561==    by 0x1195C5: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:582)
==404561==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==404561==    by 0x10D5B9: main (exec.cpp:291)
==404561==  Address 0x1ffefff740 is on thread 1's stack
==404561==  in frame #1, created by ei::set_winsz(int, int, int) (exec_impl.cpp:177)
==404561==
==405903== Syscall param ioctl(TCSET{S,SW,SF}) points to uninitialised byte(s)
==405903==    at 0x4C77850: tcsetattr (tcsetattr.c:83)
==405903==    by 0x119440: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:568)
==405903==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==405903==    by 0x10D5B9: main (exec.cpp:291)
==405903==  Address 0x1ffefff6f0 is on thread 1's stack
==405903==  in frame #0, created by tcsetattr (tcsetattr.c:45)
==405903==
==405903== Conditional jump or move depends on uninitialised value(s)
==405903==    at 0x1195A3: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:581)
==405903==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==405903==    by 0x10D5B9: main (exec.cpp:291)
==405903==
==405903== Conditional jump or move depends on uninitialised value(s)
==405903==    at 0x1195AC: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:581)
==405903==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==405903==    by 0x10D5B9: main (exec.cpp:291)
==405903==
==405903== Syscall param ioctl(TIOCSWINSZ) points to uninitialised byte(s)
==405903==    at 0x4C78277: ioctl (syscall-template.S:120)
==405903==    by 0x1145C4: ei::set_winsz(int, int, int) (exec_impl.cpp:182)
==405903==    by 0x1195C5: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:582)
==405903==    by 0x10DCD0: process_command(bool) (exec.cpp:398)
==405903==    by 0x10D5B9: main (exec.cpp:291)
==405903==  Address 0x1ffefff740 is on thread 1's stack
==405903==  in frame #1, created by ei::set_winsz(int, int, int) (exec_impl.cpp:177)
==405903==

@kape1395
Copy link
Contributor Author

kape1395 commented Aug 7, 2024

It looks like it's pty related. Here is a simple case to reproduce:

1> exec:run("/usr/bin/echo asd", [sync, stdout, stderr, pty]).
exec got msg from port: {1,{pid,74130}}
exec added monitor <0.87.0> for OsPid 74130exec got msg from port: {0,{stdout,74130,<<"asd\r\n">>}}
exec got msg from port: {0,{exit_status,74130,0}}
Pid 74130 exited with status: {0,0}
<0.87.0> 74130 got down message ({status,0}) (ismon=true)
{ok,[{stdout,[<<"asd\r\n">>]}]}

Results in valgrind report:

==74130== Syscall param ioctl(TCSET{S,SW,SF}) points to uninitialised byte(s)
==74130==    at 0x4C46D10: tcsetattr (tcsetattr.c:83)
==74130==    by 0x11DC65: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:568)
==74130==    by 0x1121BA: process_command(bool) (exec.cpp:398)
==74130==    by 0x10DBC1: main (exec.cpp:291)
==74130==  Address 0x1ffeffe300 is on thread 1's stack
==74130==  in frame #0, created by tcsetattr (tcsetattr.c:45)
==74130== 
==74130== Conditional jump or move depends on uninitialised value(s)
==74130==    at 0x11CE50: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:581)
==74130==    by 0x1121BA: process_command(bool) (exec.cpp:398)
==74130==    by 0x10DBC1: main (exec.cpp:291)
==74130== 
==74130== Syscall param ioctl(TIOCSWINSZ) points to uninitialised byte(s)
==74130==    at 0x4C4EDED: ioctl (ioctl.c:36)
==74130==    by 0x1151FD: ei::set_winsz(int, int, int) (exec_impl.cpp:182)
==74130==    by 0x11CE58: ei::start_child(ei::CmdOptions&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (exec_impl.cpp:582)
==74130==    by 0x1121BA: process_command(bool) (exec.cpp:398)
==74130==    by 0x10DBC1: main (exec.cpp:291)
==74130==  Address 0x1ffeffe340 is on thread 1's stack
==74130==  in frame #1, created by ei::set_winsz(int, int, int) (exec_impl.cpp:177)

In my case, it's not critical to use the pty option. It was used accidentally. But I hope that helps.

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

2 participants