Commit Graph

18899 Commits

Author SHA1 Message Date
Max Kellermann 7c4ddb5943 input/uring: initialize uring_input_queue lazily
The BlockingCall() in InitUringInputPlugin() did not work because the
EventThread was not yet started.  This was never noticed until commit
e309941646 which enabled `IORING_SETUP_SINGLE_ISSUER`, and suddenly
the kernel refused to accept io_uring_submit() calls from the
io_thread because io_uring_setup() had been called from the main
thread.
2025-01-30 20:00:57 +01:00
Max Kellermann 3cf5354e3f Revert "Main: start IO threads before initializing the rest"
This reverts commit abc8420697.  This
was a bad idea, too, because it broke daemonization.
2025-01-30 19:58:15 +01:00
Max Kellermann 838398103c Revert "event/Thread: start the thread in the constructor"
This reverts commit b49cfe96f4.  It was
a bad idea because it broke signal handlers.  I need to find a better
way to fix io_uring intialization.
2025-01-30 19:58:15 +01:00
Max Kellermann 30bd70939a lib/nfs/Connection: remove unnecessary include 2025-01-30 17:24:20 +01:00
Max Kellermann 275cd9d1d0 lib/nfs/Connection: give up connection after NFS4ERR_EXPIRED
Once a NFS request fails with NFS4ERR_EXPIRED, the whole connection is
broken and we need to open a new one.  I wish libnfs would report this
to us as a connection-level error, but instead only the one request
fails; therefore this workaround is an ugly kludge.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2175
2025-01-30 17:23:39 +01:00
Max Kellermann 5b001957c7 input/async: skip resume and seek if there is a pending error
The resume/seek was received asynchronously and meanwhile an error
might have occurred that needs to be handled.

This fixes another NFS-related crash bug.
2025-01-30 16:47:51 +01:00
Max Kellermann d1e5c90c3b decoder/flac: do not seek when DecoderCommand::STOP is received
libFLAC tries to keep on seeking a stream even after a (fatal) read
error has occurred.  Let the DecoderClient decide whether proceeding
is possible.

This fixes a crash bug when playing a file over NFS and the NFS
connection fails.
2025-01-30 16:46:04 +01:00
Max Kellermann 715ef846b6 input/Plugin: pass URI as std::string_view 2025-01-30 13:38:30 +01:00
Max Kellermann aee49d1c1c input/cdio: pass std::string_view to parse_cdio_uri() 2025-01-30 13:17:47 +01:00
Max Kellermann 459390cd56 input/alsa: use std::string_view in class SourceSpec 2025-01-30 13:03:52 +01:00
Max Kellermann 7ca8dedb35 pcm/AudioParser: use std::string_view 2025-01-30 12:27:20 +01:00
Max Kellermann f6cee35896 fs/Traits: add IsAbsolute(string_view) 2025-01-30 11:55:44 +01:00
gd 66ee03741d Logging: enable log timestamp to stdout logging
When running with stdout output to debug the server
or misbehaving clients, it is useful to have the timestamp
to detect timing issues and response times.
Especially when opening and playing online sources that
block the connection thread sometime for a significantly
long time that makes the client-server unresponsive
and cause timeouts in clients.
2025-01-30 11:33:21 +01:00
Max Kellermann b49cfe96f4 event/Thread: start the thread in the constructor
This is the proper fix for the e309941646 regression; see
commit abc8420697
2025-01-30 10:58:34 +01:00
Max Kellermann ae112fe077 Merge branch 'sticker_errors' of https://github.com/jcorporation/MPD 2025-01-30 10:48:18 +01:00
Max Kellermann a1cbfa1623 Merge branch 'sticker_set' of https://github.com/jcorporation/MPD 2025-01-30 10:46:23 +01:00
Max Kellermann e06d775af5 util/CircularBuffer: add method MoveTo()
This implements wraparound, so AsyncInputStream and ThreadInputStream
can now return all of the buffer contents in one Read() call.
2025-01-29 21:28:28 +01:00
Max Kellermann 950f5f4d32 input/{async,thread}: move code to ReadFromBuffer() 2025-01-29 21:26:05 +01:00
Max Kellermann abc8420697 Main: start IO threads before initializing the rest
This fixes a regression triggered by commit e309941646 -
IORING_SETUP_SINGLE_ISSUER broke because io_uring_setup() was called
fromm the main thread, yet io_uring_submit() in the I/O thread.  This
is because the I/O thread was not yet started when
InitUringInputPlugin() was called, and BlockingCall() was invoked
synchronously in the main thread.  This has always been wrong, but was
never noticed.
2025-01-29 21:25:59 +01:00
Max Kellermann e309941646 event/Loop: initialize io_uring with IORING_SETUP_SINGLE_ISSUER
This might give tiny kernel-side optimizations.
2025-01-29 20:29:42 +01:00
Max Kellermann ea2ced6b9f event/UringManager: replace with new Uring::Manager class
From https://github.com/CM4all/libcommon - the new class is mostly
identical, and I want to maintain only one of them.
2025-01-29 20:27:13 +01:00
Max Kellermann f1d06396a7 client: replace num with a name string
This logs the client address (or the process id and uid for local
connections) in each log line instead of the number.
2025-01-29 20:24:05 +01:00
Max Kellermann 95c0e2505c client/New: pass SocketPeerCredentials to client_new() 2025-01-29 19:36:47 +01:00
Max Kellermann 7adda0aa66 event/ServerSocket: move GetPeerCredentials() call to ClientListener::OnAccept() 2025-01-29 19:32:53 +01:00
Max Kellermann a0825e6ce0 net/PeerCredentials: add getpeereid() support 2025-01-29 19:28:09 +01:00
Max Kellermann c7621ec0e4 net/PeerCredentials: wrapper for struct ucred 2025-01-29 19:28:03 +01:00
Max Kellermann 2c7ca16c4e lib/fmt/ToBuffer: add constexpr 2025-01-29 18:12:08 +01:00
Max Kellermann ad8c2577c4 util/PackedBigEndian: add class PackedSignedBE16 2025-01-29 18:11:47 +01:00
Max Kellermann 7c9a460786 io/uring/Ring: add method SetMaxWorkers() 2025-01-29 18:10:59 +01:00
Max Kellermann c644b7616a io/uring/Ring: add ctor wrapping io_uring_queue_init_params() 2025-01-29 18:10:20 +01:00
Max Kellermann badf7101e2 io/uring/Ring: use if with initializer 2025-01-29 18:10:04 +01:00
Max Kellermann 6fb91e661c io/uring/Queue: DispatchCompletions() returns bool 2025-01-29 18:09:57 +01:00
Max Kellermann ed819a05e3 io/uring/Ring: add SubmitAndGetEvents() 2025-01-29 18:09:52 +01:00
Max Kellermann 2e3a51a5da io/uring/Close: use IOSQE_CQE_SKIP_SUCCESS
We don't want to get any completion events for "close".  It's
fire-and-forget.
2025-01-29 18:09:29 +01:00
Max Kellermann e682940c54 event/PipeEvent: add GetScheduledFlags(), [GS]etReadyFlags() 2025-01-29 18:09:10 +01:00
Max Kellermann fa375cbaeb event/uring/Manager: un-inline the ctor 2025-01-29 18:09:06 +01:00
Max Kellermann 3f638bfa03 io/uring/Operation: add method GetUringData() 2025-01-29 18:07:55 +01:00
Max Kellermann 0ba0c64093 event/uring/Manager: add flags parameter 2025-01-29 18:07:46 +01:00
Max Kellermann 5e107c33d9 event/DeferEvent: add ScheduleNext() 2025-01-29 18:05:50 +01:00
Max Kellermann 4bb379a218 event/ServerSocket: use SocketDescriptor::GetPeerCredentials() 2025-01-29 17:56:26 +01:00
Max Kellermann 3710b54d43 event/ServerSocket: pass SocketDescriptor to get_remote_uid() 2025-01-29 17:56:26 +01:00
Max Kellermann 70f1f9cff8 subprojects: update gtest to 1.15.2 2025-01-29 17:41:24 +01:00
Max Kellermann 9787d39c3f subprojects: update expat to 2.6.4 2025-01-29 17:41:11 +01:00
Max Kellermann 54527068d5 .github/workflows/build.yml: fix matrix name
Regression by commit ab011adf77
2025-01-29 17:35:33 +01:00
Max Kellermann 0186f73c7a client/Process: let libfmt quote the command string 2025-01-29 17:32:42 +01:00
gd 88594c81d6 Logging: added seconds to log time string.
Time was only in minutes before.
Seconds is more useful in analyzing the log for example
with issues of timeouts, and reponse times.
2025-01-29 17:31:21 +01:00
Max Kellermann f6bd49ba61 Merge branch 'tag-compare' of https://github.com/geneticdrift/MPD 2025-01-29 17:21:54 +01:00
Max Kellermann a404e5754e Merge tag 'v0.23.17'
release v0.23.17
2025-01-29 17:20:02 +01:00
Max Kellermann b080ca8627 release v0.23.17 2025-01-29 17:11:53 +01:00
Max Kellermann 0e8cd3b961 client/Process: explicitly disallow "idle" and "noidle" in command lists
These commands cannot possibly work with command lists because command
lists are supposed to be atomic, but suspended command execution
conflicts with that.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2167
2025-01-29 17:08:53 +01:00