Skip to content

et: fix typo in ET_COMMAND_REGEX - #8

Merged
MisterTea merged 1 commit into
MisterTea:masterfrom
kyungminlee:patch-1
Mar 1, 2017
Merged

MisterTea merged 1 commit into
MisterTea:masterfrom
kyungminlee:patch-1

Conversation

@kyungminlee

Copy link
Copy Markdown
Contributor

No description provided.

@MisterTea
MisterTea merged commit 5356ddf into MisterTea:master Mar 1, 2017
@MisterTea

Copy link
Copy Markdown
Owner

Thanks!

joshuataylor added a commit to joshuataylor/EternalTerminal that referenced this pull request May 3, 2024
Linux does not use arm64 for uname, so grep does not work, leading in a
resulting confusing error.

MacOS (Ventura):

```
Darwin foo 22.6.0 Darwin Kernel Version 22.6.0: Mon Feb 19 19:43:13 PST
2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_T6020 arm64 arm Darwin
```

Linux aarch64 (OrangePi, Ubuntu 22.04):
```
Linux foo 5.10.160-rockchip MisterTea#37 SMP Fri Apr 26 05:16:30 UTC 2024 aarch64
aarch64 aarch64 GNU/Linux
```

Linux aarch64 (AWS, Ubuntu 24.04):
```
Linux foo 6.8.0-1008-aws MisterTea#8-Ubuntu SMP Sat Apr 20 02:43:14 UTC 2024
aarch64 aarch64 aarch64 GNU/Linux
```

Tested with both system grep and grep 3.11 installed via Homebrew for
MacOS:

```
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
```

Homebrew:
```
grep (GNU grep) 3.11
Packaged by Homebrew
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.

grep -P uses PCRE2 10.43 2024-02-16
```

Consistency, yay.
MisterTea pushed a commit that referenced this pull request May 3, 2024
Linux does not use arm64 for uname, so grep does not work, leading in a
resulting confusing error.

MacOS (Ventura):

```
Darwin foo 22.6.0 Darwin Kernel Version 22.6.0: Mon Feb 19 19:43:13 PST
2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_T6020 arm64 arm Darwin
```

Linux aarch64 (OrangePi, Ubuntu 22.04):
```
Linux foo 5.10.160-rockchip #37 SMP Fri Apr 26 05:16:30 UTC 2024 aarch64
aarch64 aarch64 GNU/Linux
```

Linux aarch64 (AWS, Ubuntu 24.04):
```
Linux foo 6.8.0-1008-aws #8-Ubuntu SMP Sat Apr 20 02:43:14 UTC 2024
aarch64 aarch64 aarch64 GNU/Linux
```

Tested with both system grep and grep 3.11 installed via Homebrew for
MacOS:

```
grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
```

Homebrew:
```
grep (GNU grep) 3.11
Packaged by Homebrew
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>.

grep -P uses PCRE2 10.43 2024-02-16
```

Consistency, yay.
psaab added a commit to psaab/EternalTerminal that referenced this pull request Jun 2, 2026
UnixSocketHandler::accept() called FATAL_FAIL on any accept() errno
other than EAGAIN/EWOULDBLOCK, aborting the entire server. accept(2)
routinely returns benign per-connection errors -- notably ECONNABORTED
(the peer reset the connection before we accepted it) and EINTR. These
are surfaced readily on FreeBSD by clients that connect and immediately
disconnect (keepalive/reconnect churn), crashing etserver.

Treat EAGAIN, EWOULDBLOCK, ECONNABORTED, and EINTR as non-fatal and
return -1; the accept loop already handles this by retrying. Genuinely
unexpected errnos still fail fatally.

Backtrace on FreeBSD:

  #0  thr_kill () at thr_kill.S:4
  MisterTea#1  __raise (s=s@entry=6) at /usr/src/lib/libc/gen/raise.c:50
  MisterTea#2  abort () at /usr/src/lib/libc/stdlib/abort.c:64
  MisterTea#3  el::base::utils::abort (status=1, reason="Fatal log at [.../src/base/UnixSocketHandler.cpp:146] ...")
      at external_imported/easyloggingpp/src/easylogging++.cc:125
  MisterTea#4  el::base::Writer::triggerDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2653
  MisterTea#5  el::base::Writer::processDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2616
  MisterTea#6  el::base::Writer::~Writer () at external_imported/easyloggingpp/src/easylogging++.h:3209
  MisterTea#7  et::UnixSocketHandler::accept (this=..., sockFd=10) at src/base/UnixSocketHandler.cpp:146
  MisterTea#8  et::ServerConnection::acceptNewConnection (this=..., fd=10) at src/base/ServerConnection.cpp:17
  MisterTea#9  et::TerminalServer::run (this=...) at src/terminal/TerminalServer.cpp:79
  MisterTea#10 main (argc=6, argv=...) at src/terminal/TerminalServerMain.cpp:203

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
psaab added a commit to psaab/EternalTerminal that referenced this pull request Jun 2, 2026
UnixSocketHandler::accept() called FATAL_FAIL on any accept() errno
other than EAGAIN/EWOULDBLOCK, aborting the entire server. accept(2)
routinely returns benign per-connection errors -- notably ECONNABORTED
(the peer reset the connection before we accepted it) and EINTR. These
are surfaced readily on FreeBSD by clients that connect and immediately
disconnect (keepalive/reconnect churn), crashing etserver.

Treat EAGAIN, EWOULDBLOCK, ECONNABORTED, and EINTR as non-fatal and
return -1; the accept loop already handles this by retrying. Genuinely
unexpected errnos still fail fatally.

Backtrace on FreeBSD:

  #0  thr_kill () at thr_kill.S:4
  MisterTea#1  __raise (s=s@entry=6) at /usr/src/lib/libc/gen/raise.c:50
  MisterTea#2  abort () at /usr/src/lib/libc/stdlib/abort.c:64
  MisterTea#3  el::base::utils::abort (status=1, reason="Fatal log at [.../src/base/UnixSocketHandler.cpp:146] ...")
      at external_imported/easyloggingpp/src/easylogging++.cc:125
  MisterTea#4  el::base::Writer::triggerDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2653
  MisterTea#5  el::base::Writer::processDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2616
  MisterTea#6  el::base::Writer::~Writer () at external_imported/easyloggingpp/src/easylogging++.h:3209
  MisterTea#7  et::UnixSocketHandler::accept (this=..., sockFd=10) at src/base/UnixSocketHandler.cpp:146
  MisterTea#8  et::ServerConnection::acceptNewConnection (this=..., fd=10) at src/base/ServerConnection.cpp:17
  MisterTea#9  et::TerminalServer::run (this=...) at src/terminal/TerminalServer.cpp:79
  MisterTea#10 main (argc=6, argv=...) at src/terminal/TerminalServerMain.cpp:203
psaab added a commit to psaab/EternalTerminal that referenced this pull request Jun 2, 2026
UnixSocketHandler::accept() called FATAL_FAIL on any accept() errno
other than EAGAIN/EWOULDBLOCK, aborting the entire server. accept(2)
routinely returns benign per-connection errors -- notably ECONNABORTED
(the peer reset the connection before we accepted it) and EINTR. These
are surfaced readily on FreeBSD by clients that connect and immediately
disconnect (keepalive/reconnect churn), crashing etserver.

Treat EAGAIN, EWOULDBLOCK, ECONNABORTED, and EINTR as non-fatal and
return -1; the accept loop already handles this by retrying. Genuinely
unexpected errnos still fail fatally.

Backtrace on FreeBSD:

  #0  thr_kill () at thr_kill.S:4
  MisterTea#1  __raise (s=s@entry=6) at /usr/src/lib/libc/gen/raise.c:50
  MisterTea#2  abort () at /usr/src/lib/libc/stdlib/abort.c:64
  MisterTea#3  el::base::utils::abort (status=1, reason="Fatal log at [.../src/base/UnixSocketHandler.cpp:146] ...")
      at external_imported/easyloggingpp/src/easylogging++.cc:125
  MisterTea#4  el::base::Writer::triggerDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2653
  MisterTea#5  el::base::Writer::processDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2616
  MisterTea#6  el::base::Writer::~Writer () at external_imported/easyloggingpp/src/easylogging++.h:3209
  MisterTea#7  et::UnixSocketHandler::accept (this=..., sockFd=10) at src/base/UnixSocketHandler.cpp:146
  MisterTea#8  et::ServerConnection::acceptNewConnection (this=..., fd=10) at src/base/ServerConnection.cpp:17
  MisterTea#9  et::TerminalServer::run (this=...) at src/terminal/TerminalServer.cpp:79
  MisterTea#10 main (argc=6, argv=...) at src/terminal/TerminalServerMain.cpp:203
psaab added a commit to psaab/EternalTerminal that referenced this pull request Jun 5, 2026
UnixSocketHandler::accept() called FATAL_FAIL on any accept() errno
other than EAGAIN/EWOULDBLOCK, aborting the entire server. accept(2)
routinely returns benign per-connection errors -- notably ECONNABORTED
(the peer reset the connection before we accepted it) and EINTR. These
are surfaced readily on FreeBSD by clients that connect and immediately
disconnect (keepalive/reconnect churn), crashing etserver.

Treat EAGAIN, EWOULDBLOCK, ECONNABORTED, and EINTR as non-fatal and
return -1; the accept loop already handles this by retrying. Genuinely
unexpected errnos still fail fatally.

Backtrace on FreeBSD:

  #0  thr_kill () at thr_kill.S:4
  MisterTea#1  __raise (s=s@entry=6) at /usr/src/lib/libc/gen/raise.c:50
  MisterTea#2  abort () at /usr/src/lib/libc/stdlib/abort.c:64
  MisterTea#3  el::base::utils::abort (status=1, reason="Fatal log at [.../src/base/UnixSocketHandler.cpp:146] ...")
      at external_imported/easyloggingpp/src/easylogging++.cc:125
  MisterTea#4  el::base::Writer::triggerDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2653
  MisterTea#5  el::base::Writer::processDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2616
  MisterTea#6  el::base::Writer::~Writer () at external_imported/easyloggingpp/src/easylogging++.h:3209
  MisterTea#7  et::UnixSocketHandler::accept (this=..., sockFd=10) at src/base/UnixSocketHandler.cpp:146
  MisterTea#8  et::ServerConnection::acceptNewConnection (this=..., fd=10) at src/base/ServerConnection.cpp:17
  MisterTea#9  et::TerminalServer::run (this=...) at src/terminal/TerminalServer.cpp:79
  MisterTea#10 main (argc=6, argv=...) at src/terminal/TerminalServerMain.cpp:203
MisterTea pushed a commit that referenced this pull request Jun 5, 2026
* base: Fix etserver crash on transient accept() errors

UnixSocketHandler::accept() called FATAL_FAIL on any accept() errno
other than EAGAIN/EWOULDBLOCK, aborting the entire server. accept(2)
routinely returns benign per-connection errors -- notably ECONNABORTED
(the peer reset the connection before we accepted it) and EINTR. These
are surfaced readily on FreeBSD by clients that connect and immediately
disconnect (keepalive/reconnect churn), crashing etserver.

Treat EAGAIN, EWOULDBLOCK, ECONNABORTED, and EINTR as non-fatal and
return -1; the accept loop already handles this by retrying. Genuinely
unexpected errnos still fail fatally.

Backtrace on FreeBSD:

  #0  thr_kill () at thr_kill.S:4
  #1  __raise (s=s@entry=6) at /usr/src/lib/libc/gen/raise.c:50
  #2  abort () at /usr/src/lib/libc/stdlib/abort.c:64
  #3  el::base::utils::abort (status=1, reason="Fatal log at [.../src/base/UnixSocketHandler.cpp:146] ...")
      at external_imported/easyloggingpp/src/easylogging++.cc:125
  #4  el::base::Writer::triggerDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2653
  #5  el::base::Writer::processDispatch () at external_imported/easyloggingpp/src/easylogging++.cc:2616
  #6  el::base::Writer::~Writer () at external_imported/easyloggingpp/src/easylogging++.h:3209
  #7  et::UnixSocketHandler::accept (this=..., sockFd=10) at src/base/UnixSocketHandler.cpp:146
  #8  et::ServerConnection::acceptNewConnection (this=..., fd=10) at src/base/ServerConnection.cpp:17
  #9  et::TerminalServer::run (this=...) at src/terminal/TerminalServer.cpp:79
  #10 main (argc=6, argv=...) at src/terminal/TerminalServerMain.cpp:203

* test: Cover accept() transient-error handling

Add unit tests for UnixSocketHandler::isTransientAcceptError(), the helper
that decides which accept() errnos are recoverable. This exercises the
ECONNABORTED and EINTR cases (the FreeBSD crash) directly, plus EAGAIN/
EWOULDBLOCK, and confirms genuine errors (EBADF, EINVAL, ...) stay fatal.

Also add an end-to-end check that accept() on a non-blocking listening
socket with no pending connection returns -1 instead of aborting.
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

Successfully merging this pull request may close these issues.

2 participants