to repeat: 1. Go to /cgi-bin/koha/members/member.pl 2. put this test into the "Search for patron" "Search:" field: "some long test to search in patron fields" 3. Observe "nothing found" but in the server log, it will say (28)No space left on device: [client 127.0.0.1:60330] AH10124: header size is over the limit allowed by ResponseFieldSize (8192 bytes). Bad response header: 'Link: <https://... this of course happens when you searching for something long but seems we came to so long URL which fails to fit into the "forward" (Link: ... header) field, if to debug, it creates a "search" API request URL that is already 5219 bytes long, then this URL is re-encoded and put two times inside the "Link:" header, so it quickly jumps over the 8192 bytes header limit. Note: as we found together that solution in Koha/REST/Plugin/Pagination.pm to split @links in separate "Link:" headers. SIDENOTE: considering that we already have URL 5129 long in this example, we might anyway even without header doubling bump into the 8192 limits (!). We might need re-think later how in general this formed up. Not related to the current shorter fix though.
Created attachment 137240 [details] [review] Bug 31104: Put each link on a separate header This patch makes the Pagination helper put each Link entry on the response headers on a separate header. In practice, this leads to shorter headers and will avoid apache default/reasonable limits. To test: 1. Open the patron search page 2. Open the koha logs: $ tail -f /var/log/koha/kohadev/*.log 3. On the 'Search for patron' input, use a really long string, like 'superlongstringthatistoolongforapacheyeahsuperlong' => SUCCESS: There's no user with an attribute with that content :-D => FAIL: You get an error like (28)No space left on device: [client 127.0.0.1:60330] AH10124: header size is over the limit allowed by ResponseFieldSize (8192 bytes). Bad response header: 'Link:...' 4. Apply this patch 5. Restart all: $ restart_all 6. Repeat 2 and 3 => SUCCESS: No results => SUCCESS: No error in the logs 7. Run: $ kshell k$ prove t/Koha/REST/Plugin/Pagination.t \ t/db_dependent/api/v1/*.t => SUCCESS: Tests pass! Note 1: The Link header is expected to be in CSV format, which is usually the way libraries treat repeated headers anyway. Note 2: Apache is not rejecting the response, just stripping out the 'bad header'. So this is not a critical issue. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
I'm not seeing the error described in step 3. Are there some other settings required to generate the error? Testing on master with koha-testing-docker.
(In reply to David Nind from comment #2) > I'm not seeing the error described in step 3. I had to put a longer and longer string to reach the limit. Just add some random chars.
Created attachment 137433 [details] [review] Bug 31104: Put each link on a separate header This patch makes the Pagination helper put each Link entry on the response headers on a separate header. In practice, this leads to shorter headers and will avoid apache default/reasonable limits. To test: 1. Open the patron search page 2. Open the koha logs: $ tail -f /var/log/koha/kohadev/*.log 3. On the 'Search for patron' input, use a really long string, like 'superlongstringthatistoolongforapacheyeahsuperlong' => SUCCESS: There's no user with an attribute with that content :-D => FAIL: You get an error like (28)No space left on device: [client 127.0.0.1:60330] AH10124: header size is over the limit allowed by ResponseFieldSize (8192 bytes). Bad response header: 'Link:...' 4. Apply this patch 5. Restart all: $ restart_all 6. Repeat 2 and 3 => SUCCESS: No results => SUCCESS: No error in the logs 7. Run: $ kshell k$ prove t/Koha/REST/Plugin/Pagination.t \ t/db_dependent/api/v1/*.t => SUCCESS: Tests pass! Note 1: The Link header is expected to be in CSV format, which is usually the way libraries treat repeated headers anyway. Note 2: Apache is not rejecting the response, just stripping out the 'bad header'. So this is not a critical issue. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Michal Urban <michalurban177@gmail.com>
Created attachment 137517 [details] [review] Bug 31104: Put each link on a separate header This patch makes the Pagination helper put each Link entry on the response headers on a separate header. In practice, this leads to shorter headers and will avoid apache default/reasonable limits. To test: 1. Open the patron search page 2. Open the koha logs: $ tail -f /var/log/koha/kohadev/*.log 3. On the 'Search for patron' input, use a really long string, like 'superlongstringthatistoolongforapacheyeahsuperlong' => SUCCESS: There's no user with an attribute with that content :-D => FAIL: You get an error like (28)No space left on device: [client 127.0.0.1:60330] AH10124: header size is over the limit allowed by ResponseFieldSize (8192 bytes). Bad response header: 'Link:...' 4. Apply this patch 5. Restart all: $ restart_all 6. Repeat 2 and 3 => SUCCESS: No results => SUCCESS: No error in the logs 7. Run: $ kshell k$ prove t/Koha/REST/Plugin/Pagination.t \ t/db_dependent/api/v1/*.t => SUCCESS: Tests pass! Note 1: The Link header is expected to be in CSV format, which is usually the way libraries treat repeated headers anyway. Note 2: Apache is not rejecting the response, just stripping out the 'bad header'. So this is not a critical issue. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Michal Urban <michalurban177@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Nice clear fix Tomas, thanks. All works as expected.. perhaps it might have been nice to see a unit test for it, but otherwise, I'm happy here. Passing QA.
Pushed to master for 22.11. Nice work everyone, thanks!
Created attachment 137610 [details] [review] Bug 31104: Add a selenium test
Will still pass after bug 31138.
Thanks, Jonathan!
Created attachment 137628 [details] [review] Bug 31104: Add a selenium test
No sure what's going on here, but the selenium tests are failing on jenkins. They are passing with and without commit "Bug 31104: Put each link on a separate header" They are failing after bug 31138. And actually this patch does not fix the problem, I am still getting "414 Request-URI Too Long".
Tests reverted.