search for: _handle_single_connection

Displaying 20 results from an estimated 37 matches for "_handle_single_connection".

2019 Mar 18
2
[PATCH nbdkit] wrapper: Set MALLOC_CHECK=1 and MALLOC_PERTURB_ (randomly).
...004066ff in filter_free (b=0x203c330) at filters.c:77 #3 0x000000000040a6f4 in main (argc=11, argv=0x7ffc1f4486e8) at main.c:649 Thread 1 (Thread 0x7f1caaa5e700 (LWP 7226)): #0 0x000000000040732a in filter_finalize (b=0x203c330, conn=0x203d870) at filters.c:421 #1 0x0000000000404d07 in _handle_single_connection (sockin=6, sockout=6) at connections.c:239 #2 0x0000000000404d76 in handle_single_connection (sockin=6, sockout=6) at connections.c:258 #3 0x00000000004119f6 in start_thread (datav=0x203b450) at sockets.c:263 #4 0x00007f1cab09b5a2 in start_thread () from /lib64/libpthread.so.0 #5...
2018 Jan 17
0
[PATCH 4/9] backend: Add a .plugin_name method.
...ll be different). --- src/connections.c | 4 ++-- src/internal.h | 1 + src/plugins.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/connections.c b/src/connections.c index 921a5b2..e1ac543 100644 --- a/src/connections.c +++ b/src/connections.c @@ -221,7 +221,7 @@ _handle_single_connection (int sockin, int sockout) if (backend->open (backend, conn, readonly) == -1) goto done; - threadlocal_set_name (backend->name (backend)); + threadlocal_set_name (backend->plugin_name (backend)); /* Handshake. */ if (negotiate_handshake (conn) == -1) @@ -253,7 +253,7 @@...
2019 Nov 02
2
[PATCH nbdkit] server: Use GCC hints to move debug and error handling code out of hot paths.
...pe[1] >= 0); if (write (conn->status_pipe[1], &c, 1) != 1 && errno != EAGAIN) - nbdkit_debug ("failed to notify pipe-to-self: %m"); + debug ("failed to notify pipe-to-self: %m"); } conn->status = value; } @@ -176,7 +176,7 @@ _handle_single_connection (int sockin, int sockout) debug ("handshake complete, processing requests with %d threads", nworkers); workers = calloc (nworkers, sizeof *workers); - if (!workers) { + if (unlikely (!workers)) { perror ("malloc"); goto done; } @@ -...
2019 Nov 04
3
[PATCH nbdkit 0/3] server: Fix crash on close.
This fixes the long-standing crash on close when nbdkit exits. I did try first to fix threads so we're using a proper thread pool, but that's difficult to implement. So this does the minimal change needed to fix the crash instead. There are still two segfaults that happen during running the test suite. One is deliberately caused (tests/test-captive.sh). The other appears to be an
2018 Apr 12
3
[PATCH nbdkit 0/2] connections: Protect open and close callbacks with the request lock.
I'm fairly sure that these bugs which appear in the Python plugin: https://bugzilla.redhat.com/show_bug.cgi?id=1566516 https://bugzilla.redhat.com/show_bug.cgi?id=1566522 are really bugs in the SERIALIZE_ALL_REQUESTS thread model. See the first patch for the full explanation. The second patch is a fix for a race condition which is probably nudged into being by the first patch. Now this
2017 Nov 17
8
[RFC nbdkit PATCH 0/6] Enable full parallel request handling
I want to make my nbd forwarding plugin fully parallel - but to do that, I first need to make nbdkit itself fully parallel ;) With this series, I was finally able to demonstrate out-of-order responses when using qemu-io (which is great at sending back-to-back requests prior to waiting for responses) coupled with the nbd file plugin (which has a great feature of rdelay and wdelay, to make it
2018 Jan 17
0
[PATCH 1/9] plugins: Move locking to a new file.
...++ b/src/Makefile.am @@ -40,6 +40,7 @@ nbdkit_SOURCES = \ crypto.c \ errors.c \ internal.h \ + locks.c \ main.c \ plugins.c \ protocol.h \ diff --git a/src/connections.c b/src/connections.c index 111a810..74bb8e4 100644 --- a/src/connections.c +++ b/src/connections.c @@ -211,7 +211,7 @@ _handle_single_connection (int sockin, int sockout) int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; - if (!plugin_is_parallel() || nworkers == 1) + if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) nworkers = 0; conn = new_connection (so...
2018 Jan 16
0
[PATCH nbdkit 1/3] plugins: Move locking to a new file.
...++ b/src/Makefile.am @@ -40,6 +40,7 @@ nbdkit_SOURCES = \ crypto.c \ errors.c \ internal.h \ + locks.c \ main.c \ plugins.c \ protocol.h \ diff --git a/src/connections.c b/src/connections.c index 111a810..74bb8e4 100644 --- a/src/connections.c +++ b/src/connections.c @@ -211,7 +211,7 @@ _handle_single_connection (int sockin, int sockout) int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; - if (!plugin_is_parallel() || nworkers == 1) + if (plugin_thread_model () < NBDKIT_THREAD_MODEL_PARALLEL || nworkers == 1) nworkers = 0; conn = new_connection (so...
2017 Nov 17
0
[nbdkit PATCH 6/6] Add --threads option for supporting true parallel requests
...nections.c @@ -59,6 +59,9 @@ /* Maximum length of any option data (bytes). */ #define MAX_OPTION_LENGTH 4096 +/* Default number of parallel requests. */ +#define DEFAULT_PARALLEL_REQUESTS 16 + /* Connection structure. */ struct connection { pthread_mutex_t request_lock; @@ -203,9 +206,11 @@ _handle_single_connection (int sockin, int sockout) { int r = -1; struct connection *conn; - int nworkers = 1; /* TODO default to 16 for parallel plugins, with command-line override */ + int nworkers = threads ? threads : DEFAULT_PARALLEL_REQUESTS; pthread_t *workers = NULL; + if (!plugin_is_parallel()) + n...
2016 Sep 26
0
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
...2.7.so.1.0 > #9 0x00007ffff73f0af0 in py_close (handle=0x625338) at python.c:234 > #10 0x0000000000405803 in plugin_close (conn=conn@entry=0x7fffe8000910) at plugins.c:377 > #11 0x00000000004037ec in free_connection (conn=0x7fffe8000910) at connections.c:147 > #12 0x0000000000404476 in _handle_single_connection (sockout=<optimized out>, sockin=<optimized out>) at connections.c:99 > #13 handle_single_connection (sockin=<optimized out>, sockout=<optimized out>) at connections.c:109 > #14 0x0000000000405e73 in start_thread (datav=0x7fffffffdd40) at sockets.c:220 > #15 0x00007...
2017 Nov 20
10
[nbdkit PATCH v2 0/8] Support parallel transactions within single connection
I've posted some of these patches or ideas before; but now I'm confident enough with the series that it should be ready to push; at any rate, I can now run test-socket-activation in a tight loop without triggering any crashes or hangs. With this in place, I'm going back to work on making the nbd forwarder wort with the parallel thread model. Eric Blake (8): sockets: Use
2016 Sep 26
2
Re: Memory corruption when testing nbdkit python plugin with nbd-tester-client?
...-linux-gnu/libpython2.7.so.1.0 #9 0x00007ffff73f0af0 in py_close (handle=0x625338) at python.c:234 #10 0x0000000000405803 in plugin_close (conn=conn@entry=0x7fffe8000910) at plugins.c:377 #11 0x00000000004037ec in free_connection (conn=0x7fffe8000910) at connections.c:147 #12 0x0000000000404476 in _handle_single_connection (sockout=<optimized out>, sockin=<optimized out>) at connections.c:99 #13 handle_single_connection (sockin=<optimized out>, sockout=<optimized out>) at connections.c:109 #14 0x0000000000405e73 in start_thread (datav=0x7fffffffdd40) at sockets.c:220 #15 0x00007ffff79c0184 in...
2019 Mar 18
0
Re: [PATCH nbdkit] wrapper: Set MALLOC_CHECK=1 and MALLOC_PERTURB_ (randomly).
...gt; > Thread 1 (Thread 0x7f1caaa5e700 (LWP 7226)): > #0 0x000000000040732a in filter_finalize (b=0x203c330, conn=0x203d870) > at filters.c:421 ...filter_finalize() time to finish its job? But I agree that solving the race is an independent patch. > #1 0x0000000000404d07 in _handle_single_connection (sockin=6, sockout=6) > at connections.c:239 > #2 0x0000000000404d76 in handle_single_connection (sockin=6, sockout=6) > at connections.c:258 > #3 0x00000000004119f6 in start_thread (datav=0x203b450) at sockets.c:263 > #4 0x00007f1cab09b5a2 in start_thread () from /li...
2017 Sep 28
0
Re: nbdkit 1.1.15 -- test-python failure
...00000000040685d in nbdkit_debug (fs=fs@entry=0x40ace6 "close") at errors.c:91 #4 0x00000000004077d9 in plugin_close (conn=conn@entry=0x7f679c000910) at plugins.c:386 #5 0x0000000000404de3 in free_connection (conn=0x7f679c000910) at connections.c:228 #6 0x00000000004059fd in _handle_single_connection (sockout=<optimized out>, sockin=<optimized out>) at connections.c:179 #7 handle_single_connection (sockin=<optimized out>, sockout=<optimized out>) at connections.c:189 #8 0x0000000000408023 in start_thread (datav=0x7fff1a4fbbe0) at sockets.c:262 #9 0x00007f67a8...
2019 Aug 30
0
[nbdkit PATCH v2 2/2] server: Remember .open(readonly) status
...h->can_write = 0; + if (h->can_write == -1) h->can_write = b->can_write (b, conn); - } return h->can_write; } diff --git a/server/connections.c b/server/connections.c index 7609e9a7..0c1f2413 100644 --- a/server/connections.c +++ b/server/connections.c @@ -149,7 +149,7 @@ _handle_single_connection (int sockin, int sockout) goto done; lock_request (conn); - r = backend->open (backend, conn, readonly); + r = backend_open (backend, conn, readonly); unlock_request (conn); if (r == -1) goto done; diff --git a/server/filters.c b/server/filters.c index 0e10816f..a8d7dd7c 10...
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2: - Fixed everything mentioned in the review. Rich.
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are called. This patch is in preparation for adding a second backend subtype for filters. Rich.
2019 Oct 07
0
[nbdkit PATCH 5/5] server: Ensure .finalize and .close are called as needed
...repare (b, conn) == -1) { + backend_finalize (b, conn); + backend_close (b, conn); + return -1; + } + return 0; } int64_t diff --git a/server/connections.c b/server/connections.c index c6fa232f..c55d3816 100644 --- a/server/connections.c +++ b/server/connections.c @@ -216,10 +216,7 @@ _handle_single_connection (int sockin, int sockout) /* Finalize (for filters), called just before close. */ lock_request (conn); - if (backend) - r = backend_finalize (backend, conn); - else - r = 0; + r = backend_finalize (backend, conn); unlock_request (conn); if (r == -1) goto done; -- 2.21.0
2019 Aug 27
2
[PATCH nbdkit] sh: Remove assert and replace with smarter file descriptor duplication. (was: Re: [nbdkit PATCH v2 14/17] sh: Use pipe2 with CLOEXEC when possible)
...ugin.so #6 0x00007fc5d969833c in sh_close () from /usr/lib64/nbdkit/plugins/nbdkit-sh-plugin.so #7 0x0000561694bcf8e8 in plugin_close (b=<optimized out>, conn=0x56169df9afe0) at plugins.c:305 #8 0x0000561694bca649 in free_connection (conn=0x56169df9afe0) at connections.c:377 #9 _handle_single_connection (sockout=<optimized out>, sockin=<optimized out>) at connections.c:267 #10 handle_single_connection (sockin=<optimized out>, sockout=<optimized out>) at connections.c:277 #11 0x0000561694bc9583 in start_serving () at main.c:856 #12 main (argc=<optimized out>, a...
2017 Feb 20
1
Re: Fwd: nbdkit async
The concern is a client is blocked while processing a request. The nbdkit server design requires a thread per request being processed regardless of the number of connections or clients. We want to run 1000's of requests in parallel without needing a thread at nbdkit layer per request in flight. Our plugin layer is built around boost asio and a few threads in a worker pool running an io