I finally managed to track down and fix this problem yesterday. It turns out, the problem could also occur with Firebird 3 and Jaybird 3.

The problem was in Jaybird and how it skipped the padding of buffers. This worked fine for unencrypted connections, but with encrypted connections the method used for skipping those bytes did not skip bytes if an intermediate buffer was empty. This was allowed by the contract of that method, but Jaybird relied on the actual behavior of the implementation of the unencrypted connection, where it would always skip at least one byte.

The stupid thing is, I thought I already checked that and ruled it out :(

Mark

On 27-3-2018 19:08, Mark Rotteveel wrote:
I increased the TcpRemoteBufferSize to 32767 (the documented maximum value) in my firebird.conf, and when I run the full test suite of Jaybird, the tests hang consistently on the same test. It is blocked on reading from the socket during a fetch.

If I run this test in isolation it works, if I run all tests in the same class it works. It only happens when I run all tests. Given this test (like most Jaybird tests) creates a new database, it likely isn't a problem with the test itself.

If I disable wire encryption, it works. If I comment out TcpRemoteBufferSize and re-enable wire encryption, it works. If I set TcpRemoteBufferSize to 16384 or 32760 it also works fine.

This all suggests that maybe some data isn't flushed, or there might be a buffer overflow or another type of boundary issue somewhere, or that maybe somewhere an assumption of multiples of 8 bytes has crept in.

I'm not sure how long this problem has been there (and maybe it already exists in Firebird 3), I do recall having similar problems before, but I'm not sure if I changed TcpRemoteBufferSize when that happened (I sometimes do and sometimes don't change this setting). I'll see if I can find the time and energy later this week to run these tests on earlier snapshots and Firebird 3 as well, and maybe try some different values.

I hope in the meantime, that maybe one of you has an idea what the problem might be.

--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to