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

http_async_client module crashing kamailio v5.5 on startup (macos 12) #2999

Closed
joeygo opened this issue Jan 9, 2022 · 6 comments
Closed
Labels
expired portability issue related to portability Stale

Comments

@joeygo
Copy link
Contributor

joeygo commented Jan 9, 2022

Description

Hello,
Loading http_async_client module causes kamailio to crash on startup with the following errors:

 0(60541) INFO: http_async_client [async_http.c:85]: async_http_init_worker(): started worker process: 1
[warn] kevent: Bad file descriptor
16(60557) CRITICAL: <core> [core/pt.c:405]: fork_tcp_process(): called from a non "main" process
16(60557) ERROR: <core> [core/tcp_main.c:5121]: tcp_init_children(): fork failed: Bad file descriptor
 0(60541) ALERT: <core> [main.c:786]: handle_sigs(): child process 60557 exited normally, status=255
 0(60541) INFO: <core> [main.c:813]: handle_sigs(): terminating due to SIGCHLD
 1(60542) INFO: <core> [main.c:868]: sig_usr(): signal 15 received
 5(60546) INFO: <core> [main.c:868]: sig_usr(): signal 15 received

Issue reproduced with kamailio sample configuration + loadmodule "http_async_client.so"

Additional Information

  • Kamailio Version *
kamailio -v
version: kamailio 5.5.3 (x86_64/darwin) b42dfd
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, select, kqueue.
id: b42dfd 
compiled on 22:25:21 Jan  6 2022 with gcc Apple clang version 13.0.0 (clang-1300.0.29.30)
  • Operating System:
MacOS
@henningw
Copy link
Contributor

Thanks for the report. Not many people are using/building Kamailio on MacOS, so there might be not much response to this issue. Most people use Linux, but you probably know this.

@miconda
Copy link
Member

miconda commented Jan 10, 2022

I compile Kamailio and a lot of modules on MacOS as for a development environment, doing some tests as well, but not planning to use it for a production system. Considering this, if you use also tls module or others modules are linked to libssl, try with --atexit=no -- see the remarks at:

If it's not that one, then provide full details of MacOS version, I can try to reproduce and if I find a quick solution, then it will be fixed, otherwise, it will have really low priority, given that newer MacOS versions have lots of restrictions related to signed and trusted apps.

@joeygo
Copy link
Contributor Author

joeygo commented Jan 10, 2022

Thanks for your reply.
I'm using MacOS only for development purposes and not for production.
I have tried running kamailio with --atexit=no but I doesn't help.

I'm using MacBook Pro (15-inch, 2018)
Processor 2.9 GHz 6-Core Intel Core i9
macOS Monterey v12.1

I totally understand and thank you for trying..

@miconda miconda changed the title http_async_client module crashing kamailio v5.5 on startup http_async_client module crashing kamailio v5.5 on startup (macos 12) Jan 10, 2022
miconda added a commit that referenced this issue Jan 10, 2022
@miconda
Copy link
Member

miconda commented Jan 10, 2022

It seems to be failure of the libevent function event_base_dispatch(), which also logs [warn] kevent: Bad file descriptor:

 6(38960) DEBUG: http_async_client [hm_hash.c:59]: init_http_m_table(): hash table 0x10f7f82a8 initialized with size 2048
[warn] kevent: Bad file descriptor
 6(38960) ERROR: http_async_client [async_http.c:97]: async_http_run_worker(): event base dispatch failed - ret: -1 (errno: 9 - Bad file descriptor)

The above logs are from current master, as I pushed a commit to http_async_client module to exit the worker process (and thus shutdown kamailio) in the case of this failure.

Could be something that changed in the new MacOS 12 kqueue implementation. I am not familiar with libevent, maybe @grumvalski or someone else can comment or analyse further.

@miconda
Copy link
Member

miconda commented Jan 11, 2022

If it helps someone, here is a minimal config that exposes the issue at startup:

#!KAMAILIO

debug=3
log_stderror=yes

children=2

listen=udp:127.0.0.1
listen=tcp:127.0.0.1

loadmodule "tm.so"
loadmodule "pv.so"
loadmodule "http_async_client.so"


request_route {
    return;
}

@miconda miconda added the portability issue related to portability label Jan 12, 2022
rhys-hanrahan pushed a commit to rhys-hanrahan/kamailio that referenced this issue Jan 21, 2022
miconda added a commit that referenced this issue Jan 26, 2022
- exit if it fails
- part of GH #2999

(cherry picked from commit 461ec0a)
Copy link

github-actions bot commented Nov 8, 2023

This issue is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.

@github-actions github-actions bot added the Stale label Nov 8, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expired portability issue related to portability Stale
Projects
None yet
Development

No branches or pull requests

3 participants