jamulussoftware / jamulussoftware/jamulus

Firewall hangs or crashes Jamlus

Aperta
#3,776 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
C
Stelle
1.1k
Fork
248
Merge medio
2g 3h
PR unite (30g)
9

Descrizione

Describe the bug

Clicking Connect while Ethernet is active and the macOS Application Firewall is enabled causes either an immediate crash (SIGPIPE, exit code 141) or a permanent hang. WiFi is not affected.

To Reproduce

  1. Plug in Ethernet (both Ethernet and WiFi active, default route via en0)
  2. Enable the macOS Application Firewall via gui: or probably sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
  3. Launch Jamulus and click Connect
  4. The app either crashes immediately or hangs with no response from the server

Workaround: Unplug Ethernet, disable the firewall, or add Jamulus to the firewall allow list.

Expected behavior

Connect works regardless of which network interface is used and whether the firewall is enabled. If the server is unreachable, show an error instead of crashing or hanging.

Crash report (before fix)

frame #0: __sendto                          (libsystem_kernel.dylib)
frame #1: Jamulus CSocket::Send             (socket.cpp)
frame #2: Jamulus                           (ConnLessProtocol / Protocol layer)
frame #3: Jamulus                           (Protocol layer)
frame #4: QtCore QSocketNotifier            (via Qt event loop)
frame #5-8: Jamulus                         (various)
frame #9: QObject::event
frame #10: QWidget::event
frame #11-12: QtWidgets QApplication
frame #13: QtCore QCoreApplication::sendEvent
frame #14: QtCore QCoreApplicationPrivate::sendPostedEvents

Root cause (likely; AI assisted)

The macOS Application Firewall silently drops Jamulus's outgoing UDP packets when traffic originates from the Ethernet interface. WiFi works because it was already trusted (?). Before the fix, the dropped packets caused a SIGPIPE (no receiver). After the SO_NOSIGPIPE fix (handling macOS like iOS), it became a hang since the connection attempt never completes and IsConnected() stays false.

Operating system

macOS 26.5.2, Apple Silicon (arm64), Xcode 26.6

AI proposed Fix

Two changes were needed of which the first one I am not sure about:

1. SO_NOSIGPIPE (src/socket.cpp):

// Before:
#ifdef Q_OS_IOS
    int valueone = 1;
    setsockopt ( UdpSocket, SOL_SOCKET, SO_NOSIGPIPE, &valueone, sizeof ( valueone ) );
#endif

// After:
#if defined( Q_OS_IOS ) || defined( Q_OS_MACOS )
    int valueone = 1;
    setsockopt ( UdpSocket, SOL_SOCKET, SO_NOSIGPIPE, &valueone, sizeof ( valueone ) );
#endif

This prevents a SIGPIPE crash but doesn't fix the hang.

2. Connection timeout (src/clientdlg.cpp):

Added a 5-second TimerConnectTimeout in CClientDlg. If IsConnected() is still false when it fires, the app shows a warning about the firewall and disconnects. The timer is stopped on successful connection (OnConClientListMesReceived) or on manual disconnect.

To be discussed.

Additional context

/

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal percorso del crash in src/socket.cpp, in particolare da CSocket::Send, quindi esamina il flusso di connessione e le posizioni di timeout proposte in src/clientdlg.cpp e CClientDlg. Se possibile, riproduci il caso Ethernet con firewall; il lavoro è completo quando i tentativi di connessione non causano più crash o blocchi e un server irraggiungibile produce il comportamento descritto di avviso e disconnessione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, macos
Ambito
desktop, networking
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.