Commit Graph

9961 Commits

Author SHA1 Message Date
Josef Grieb
44f2cba67a
Merge pull request #21 from normanmaurer/localaddress_fix
Correctly obtain localAddress after connect was complete
2020-09-02 10:28:31 +02:00
Norman Maurer
c0ddac2c83 Correctly obtain localAddress after connect was complete
Motivation:

We need to cache the localAddress after the connect was complete

Modifications:

- Call socket.localAddress() after the connect was complete
- Enable test again

Result:

Correctly set localAddress after connect was successful
2020-09-02 10:25:03 +02:00
Josef Grieb
b4e7f046d5
Merge pull request #20 from normanmaurer/timeout_fix
Correctly implement IOUringSubmissionQueue.addTimeout(...) and ensure…
2020-09-02 10:21:23 +02:00
Norman Maurer
0a0cc8a7c0 Correctly implement IOUringSubmissionQueue.addTimeout(...) and ensure we always call runAllTasks()
Motivation:

We did have a bug in how we calculated the values for the timespec which lead to incorrect wakeups. Beside this we also missed to always call runAllTasks() which is needed to fetch the ready to be executed scheduled tasks.

Modifications:

- Fix timespec setup
- Always call runAllTasks()
- Add extra testcase
- Remove @Ignore from previous failing test

Result:

Timeouts work as expected
2020-09-02 10:16:26 +02:00
Josef Grieb
77a133344f
Merge pull request #19 from normanmaurer/close_forcibly
Fix bug that would case an IllegalStateException when closeForcibly()…
2020-09-02 09:27:01 +02:00
Norman Maurer
5423eb9401 Fix bug that would case an IllegalStateException when closeForcibly() is called and the Channel is not registered yet. 2020-09-02 09:25:27 +02:00
Josef Grieb
c7f6ba0a55
Merge pull request #18 from normanmaurer/bitmask
Use bitmasking to reduce the number of boolean variables and so save …
2020-09-02 09:23:10 +02:00
Norman Maurer
3e8e2cc0eb Use bitmasking to reduce the number of boolean variables and so save some memory per instance 2020-09-02 09:16:26 +02:00
Josef Grieb
75459d7ac7
Merge pull request #17 from normanmaurer/io_uring_tests
Add more tests from the testsuite for io_uring
2020-09-01 21:33:27 +02:00
Norman Maurer
9e6a3d6483 Add more tests from the testsuite for io_uring
Motivation:

We need more testing for io_uring to be consistent with the others transports

Modifications:

Add more tests by extending the testsuite (still some to add) and mark failing tests as ignore. These ignored tests should be fixed one by one in followup commits

Results:

More testing
2020-09-01 21:22:07 +02:00
Josef Grieb
bfc51bffd8
Merge pull request #16 from normanmaurer/composite_fix
Correctly handle CompositeByteBuf when using IOURING
2020-09-01 16:12:37 +02:00
Norman Maurer
5d7d52954b Correctly handle CompositeByteBuf when using IOURING
Motivation:

CompositeByteBuf need some special handling as well as we have multiple buffers wrapped that needs to be written via writev.

Modification:

Also handle ByteBuf with more then one nioBuffer special.

Result:

Writing CompositeByteBuf works
2020-09-01 16:06:01 +02:00
Josef Grieb
c2a10effde
Merge pull request #15 from normanmaurer/accept_active
Fix failure during accept(...)
2020-09-01 14:17:13 +02:00
Norman Maurer
614323e132 Fix failure during accept(...)
Motivation:

Sometimes accept failed as we not correctly set the active variable when constructing the server channel. This lead to the situation that we tried to add POLLIN before the channel become active and so tried to call accept before it was listen.

Modifications:

- Use the correct constructor
- Cleanup

Result:

No more accept failures.
2020-09-01 14:10:39 +02:00
Josef Grieb
51e20ecd3c
Merge pull request #14 from normanmaurer/rdhup_right_queue
Correctly handle POLLRDHUP registration in all cases
2020-09-01 11:01:03 +02:00
Norman Maurer
05d8897025 Correctly handle POLLRDHUP registration in all cases
Motivation:

When accepting a Channel we did register it for POLLRDHUP, but unfortunally we used the IOUringSubmissionQueue that is tied to the IOUringEventLoop that is used for the ServerChannel. This is not correct as the EventLoop used for the accepted Channel may be different.

Modification:

Move logic into doRegister() and so register for POLLRDHUP on the right IOURingSubmissionQueue

Result:

Correct POLLRDHUP handling
2020-09-01 10:57:06 +02:00
Josef Grieb
70682b238f
Merge pull request #13 from normanmaurer/allochandle_read
Correctly respect RecvByteBufAllocator.Handle when reading
2020-09-01 10:54:07 +02:00
Norman Maurer
663c44cd45 Correctly respect RecvByteBufAllocator.Handle when reading
Motivation:

We need to respect RecvByteBufAllocator.Handle.continueReading() so settings like MAX_MESSAGES_PER_READ are respected. This also ensures that AUTO_READ is correctly working in all cases

Modifications:

- Correctly respect continueReading();
- Fix IOUringRecvByteAllocatorHandle
- Cleanup

Result:

Correctly handling reading
2020-09-01 10:49:09 +02:00
Josef Grieb
57884e2e05
Merge pull request #12 from normanmaurer/poll_remove_fix
Correctly build up entry for POLL_REMOVE so we find the right operation
2020-09-01 01:22:19 +02:00
Norman Maurer
8e5b5400e6 Correctly build up entry for POLL_REMOVE so we find the right operation
Motivation:

We did not correctly compute all fields when POLL_REMOVE entry was calculate. Which could lead to not finding the right operation.

Modifications:

- Correctly fill all fields
- Fix unit tests

Result:

Remove IO_POLL operations work again as expected
2020-08-31 21:23:45 +02:00
Josef Grieb
e1a582d798
Merge pull request #11 from normanmaurer/auto_read
Correctly stop reading when AUTO_READ is set to off and also ensure w…
2020-08-31 17:48:05 +02:00
Norman Maurer
28db67c42b Correctly stop reading when AUTO_READ is set to off and also ensure we cancel the right poll operations 2020-08-31 17:39:08 +02:00
Josef Grieb
74c0d3dfa7
Merge pull request #10 from normanmaurer/release_memory
Correctly release memory for remote address and some code cleanup
2020-08-31 14:30:29 +02:00
Norman Maurer
186b9eb6ab Correctly release memory for remote address and some code cleanup 2020-08-31 13:22:34 +02:00
Josef Grieb
9ddf9983e8
Merge pull request #9 from normanmaurer/io_uring_rdhup
Only register for POLLRDHUP when the channel is active and include IU…
2020-08-31 11:44:22 +02:00
Norman Maurer
e41c68b151 Only register for POLLRDHUP when the channel is active and include IURING for client side in tests
Motivation:

Due a bug we did not include the IOURING based transport for clients in the testsuite. When enabling this it failed due a bug related to when we register POLLRDHUP.

Modification:

- Include IOURING clients in testsuite
- Register for RDHUP on the right time

Result:

Correctly handle RDHUP and also test IOURING for clients
2020-08-31 11:38:56 +02:00
Josef Grieb
2820edc207 Fixed SubmissionQueue full issue
Motivation:

we should use kHead(with acquire memory barrier) instead of sqeHead as submit() is called internally when sqe is full

Modification:

-submit is called internally when sqe is full
-added a new sqe full test

Result:

you no longer need to check if the sqe is full when you add a new event
2020-08-31 07:01:25 +02:00
Josef Grieb
242890899e Fixed segmentation fault error in IovecArrayPool
Motivation:

segmentation is caused in IovecArrayPool.release because the default of iovecMemoryAddress is 0

Modification:

-set default to -1
-some cleanups
-added new testsuite tests

Result:

fixed segmentation error
2020-08-31 06:41:46 +02:00
Josef Grieb
05289a3f5e
Merge pull request #8 from normanmaurer/poll_mask
Fallback to simple write when we can not allocate iovec array and cor…
2020-08-31 06:18:26 +02:00
Norman Maurer
076c35f785 Fallback to simple write when we can not allocate iovec array and correctly handle poll mask 2020-08-30 21:13:52 +02:00
Josef Grieb
f77aa54f18
Merge pull request #7 from normanmaurer/iouring_error
Correctly handle POLL*, handle errors, cleanup
2020-08-30 14:59:03 +02:00
Norman Maurer
a3585492e9 Correctly handle POLL*, handle errors, cleanup
Motivation:

We not correctly handled errors and also had some problems with home POLL* was handled.

Modifictions:

- Cleanup
- No need to for links anymore
- Add error handling for most operations (poll still missing)
- Add better handling for RDHUP
- Correctly handle writeScheduled flag for writev

Result:

Cleaner and more correct code
2020-08-30 14:41:39 +02:00
Josef Grieb
43fc06e9cf
Merge pull request #6 from normanmaurer/submit
Only need to do syscall if something was submitted
2020-08-30 14:06:08 +02:00
Norman Maurer
f6e6f543c0 Only need to do syscall if something was submitted 2020-08-30 13:41:08 +02:00
Josef Grieb
37944ccffd Add writev operation
Motivation:

writev which allows to write data into multiple buffers

Modification:

-Added iovec array pool to manage iov memory
-flush override to make sure that write is not called

Result:

performance is much better
2020-08-29 21:22:15 +02:00
Josef Grieb
9a5449a790 Poll & tests cleanups
Motivation:

we should remove pollIn link, as we don't use pollIn linking anymore

Modification:

-some cleanups in the tests and in IOUring
-pollIn linking was removed

Result:

clean code
2020-08-29 10:40:17 +02:00
Josef Grieb
356ce5fdc0
Update README.md 2020-08-29 09:12:43 +02:00
Josef Grieb
946dc3973f
Merge pull request #5 from normanmaurer/polling
Correctly handle polling
2020-08-28 17:59:05 +02:00
Norman Maurer
b863aacad4 Correctly handle polling
Motivation:

We must correctly use the polling support of io_uring to reduce the number of events in flight + only allocate buffers if really needed. For this we should respect the different poll masks and only do the corresponding IO action once the fd becomes ready for it.

Modification:

- Correctly respect poll masks and so only schedule an IO event if the fd is ready for it
- Move some code for cleanup

Result:

More correct usage of io_uring and less memory usage
2020-08-28 17:00:03 +02:00
Josef Grieb
15e7f910f0 Add README 2020-08-28 10:13:43 +02:00
Josef Grieb
8096b2c15f Add connect
Motivation:

if connect returns EINPROGRESS we send POLL OUT and check
via socket.finishConnect if the connection is successful

Modifications:

-added new io_uring connect op
-use a directbuffer for the socket address

Result:

you are able to connect to a peer
2020-08-28 09:26:35 +02:00
Josef Grieb
9fcd2926f1
Merge pull request #3 from normanmaurer/native_test_close
Correctly close ring buffer in tests so we dont leak memory
2020-08-27 11:31:31 +02:00
Norman Maurer
11e169e17a Correctly close ring buffer in tests so we dont leak memory 2020-08-27 11:29:33 +02:00
Josef Grieb
3cdb1d60ae
Merge pull request #2 from normanmaurer/io_uring_break
Add missing break statement and cleanup
2020-08-27 10:57:52 +02:00
Norman Maurer
65e8540042 Add missing break statement and cleanup 2020-08-27 10:47:03 +02:00
Josef Grieb
56ace4228f Fix server socket address already in use error even if close is called
Motivation:

when you submit a poll, io_uring still hold reference to it even if close is called
source io_uring mailing list(https://lore.kernel.org/io-uring/27657840-4E8E-422D-93BB-7F485F21341A@kernel.dk/T/#t)

Modification:

-To delete fd reference in io_uring, we use POLL_REMOVE to avoid a server socket address error
-Added a POLL_REMOVE test

Result:

server can be closed and restarted
2020-08-27 06:33:17 +02:00
Josef Grieb
6ab424f3c6 Fix checkstyle errors
Motivation:

-to fix checkstyle error and missing licence

Modification:

-Added missing license and fixed checkstyle error

Result:

it's a non functional change
2020-08-26 14:12:41 +02:00
Josef Grieb
63c490470c
Merge pull request #1 from normanmaurer/io-uring-gc
Reduce GC by remove creation of objects related to completion queue a…
2020-08-26 13:07:22 +02:00
Norman Maurer
49449b300e Reduce GC by remove creation of objects related to completion queue and submission queue
Motivation:

We did create a lot of objects related to the completion queue and submission queue which produced a lot of GC. Beside this we also did maintain an extra map which is not really needed as we can encode everything that we need in the user_data field.

Modification:

- Reduce complexity and GC pressure by store needed informations in the user_data field
- Small refactoring of the code to move channel related logic to the channel
- Remove unused classes
- Use callback to process stuff in the completion queue and so remove all GC created by it
- Simplify by not storing channel and buffer in the event

Result:

Less GC pressure and no extra lookups for events needed
2020-08-26 12:32:27 +02:00
Norman Maurer
3229d7e553 Make use of MPSC queue to reduce overhead 2020-08-25 19:04:30 +02:00