Commit Graph

8 Commits

Author SHA1 Message Date
Peter Bridgman 7e599badec macOS: Pass JackMachSemaphore send right via mach_msg IPC (#788)
* macOS: Pass JackMachSemaphore send right via mach_msg IPC

Previously, JackMachSemaphore would communicate the send right for the
semaphore object from the server to a client via a named service
registered via `bootstrap_register`. However, to do this, it would
register the semaphore's port as the service port directly.

In theory this ought to be fine, however in practice, macOS `launchd`,
which provides the `bootstrap_register` interface, does not correctly
detect when such a port becomes dead, and incorrectly believes that the
service that it provides is forever alive, even past the end of the
`jackd` process' (and therefore the semaphore's) existence. This seems
to be *specific* to semaphore ports, as `launchd` is expecting a
standard IPC port, owned by the task, not the kernel. This prevents
`jackd` from later registering another service with the same name, as
`launchd` rejects the registration as conflicting with an active service.

To get around this, `jackd` previously added a counter to the end of the
named service registrations, allowing old services to remain in the
system until the end of the session. To prevent things getting out of
hand, this was capped at 98 service registrations for a given semaphore
name. This led to #784, in which running a client for the 99th time
resulted in the semaphore creation failing and the client failing to
connect.

As `launchd` outlives multiple runs of `jackd`, this situation persisted
across restarts of `jackd`, requiring a restart of the user's session
(i.e. a reboot) to fix.

An initial attempt at fixing this (see #785) tried passing the port
rights directly via shared memory, however mach is too clever for us and
foils that plan by having port names be looked up in a per-task table
(sensible when you think about it).

In this commit, we use mach IPC messages to transfer the send right for
the semaphore from the server to the client. By registering a standard
IPC port with the bootstrap server, the service registrations are
correctly torn down when the ports are destroyed.

It works something like this:

* Server creates IPC port and registers it globally via `bootstrap_register`
* Server listens on IPC port for messages
* Client looks up IPC port via `bootstrap_look_up`
* Client sends it a message
* Server replies with a message containing a send right to the
semaphore's port
* Client is then free to use the semaphore port as before.

This resolves #784.

* Improve error handling

* Add myself to Authors
2022-01-15 15:09:55 +00:00
Thomas Brand f7f2244b07 Update AUTHORS (mgeier, #458) 2019-04-27 16:47:43 +02:00
Thomas Brand b35fa69f3f Add Arnout Diels (arre525) to authors 2019-03-26 22:47:48 +01:00
Thomas Brand f9889ea5ab Add Viktor Wilhelmsson (vikwil) to authors 2019-03-26 22:34:26 +01:00
Thomas Brand d46970bb79 Update AUTHORS file
The newly added persons have contributed code to JACK in the past.
(mentioned in at least one file header)

tests/cpu.c:    Copyright (C) 2005 Samuel TRACOL
linux/alsa/usx2y.c:    Copyright (C) 2005 Karsten Wiese, Rui Nuno Capela
linux/alsa/ice1712.h:    Copyright (C) 2000 by Jaroslav Kysela <perex@suse.cz>
example-clients/metro.c:    Copyright (C) 2002 Anthony Van Groningen
dbus/controller_iface_transport.c:    Copyright (C) 2008 Juuso Alasuutari
common/netjack.h:    Copyright (C) 2003 Robert Ham <rah@bash.sh>
common/jack/ringbuffer.h:  Copyright (C) 2003 Rohan Drape
common/jack/metadata.h:  Copyright (C) 2011 David Robillard
common/JackMidiPort.cpp:Original JACK MIDI implementation Copyright (C) 2004 Ian Esten
linux/firewire/JackFFADODriver.cpp:Copyright (C) 2012 Jonathan Woithe
common/jack/statistics.h:  Copyright (C) 2004 Rui Nuno Capela, Lee Revell

The authors list should be up-to-date now.
2019-01-26 02:18:40 +01:00
Thomas Brand 7f094b2f3b Update AUTHORS file from jackd manpage
-Add "new" alumni authors according to jackd manpage listed under "Programming"

+Andy Wingo
+Jack O'Quin
+Jeremy Hall
+Johnny Petrantoni
+Jussi Laako
+Kai Vehmanen
+Melanie Thielker
+Steve Harris
+Taybin Rutkin
+Tilman Linneweh
+Stefan Schwandter
+Alexandre Prokoudine
2019-01-24 02:26:44 +01:00
Thomas Brand e56af2e69d Update and sort AUTHORS file
-Add new authors according to https://github.com/jackaudio/jack2/graphs/contributors
-Order alphabetically by FIRST NAME (this is simple for |sort)

Karl Lindén (karllinden)
Timo Wischer (twischer-adit)
Thomas Brand (7890)
Cédric Schieli (sdrik)
Markus Seeber (mseeber)
Alba Mendez (jmendeth)
David Runge (dvzrv)
Olivier Humbert (trebmuh)
Yasuhiro Fujii (y-fujii)
Gaël Portay (gportay)
James P. Thomas (jamespthomas)
Andreas Müller (schnitzeltony)
Holger Dehnhardt (dehnhardt)
Rui Nuno Capela (rncbc)
Michał Szymański (smiszym)
Francis Pinteric (fjapinteric)
Bruno Vernay (BrunoVernay)
Hunter L. Allen (allenh1)
Edward Betts (EdwardBetts)
Thomas Petazzoni (tpetazzoni)
James Cowgill (jcowgill)
Samuel Martin (tSed)
Bernhard M. Wiedemann (bmwiedemann)
Jacek Konieczny (Jajcus)
Andrew Kelley (andrewrk)
Maks Naumov (maksqwe)
Julien Acroute (Vampouille)
Youri Westerman (4c0n)
Olaf Hering (olafhering)
Ricardo Crudo (ricardocrudo)
Maxim Grishin (Igevorse)
Valentin David (valentindavid)
Joshua Moyerman (jmoyerman)
Arnaud Rebillout (elboulangero)
Alexander Graf (agraf)
Eliot Blennerhassett (eliotb)
Deven Lahoti (dlahoti)

Not added (need more info) github handles
fps
mojofunk
e9925248
farwayer
l1n
stratakis
m-grabner
bkuhls
escitalopram
2019-01-24 01:55:01 +01:00
David Runge 1135159cd1 AUTHORS.rst: Adding a separate AUTHORS file. 2019-01-23 22:12:33 +01:00