Locust POST taking too long

51 views Asked by At

I have a small test Tomcat webserver with Spring. It has several GET and POST controllers. Most can be visited with Locust normally. But in one case, the POST takes forever to finish. There are no errors visible in Locust debug mode, or in the logs. If I wait 60s, a timeout is issued on the connection. The controller gives back a 302 and both Locust debug mode and Locust logs show that the 302 is received and followed to the success confimation page with a 200.

So no errors anywhere, just the POST taking forever, being counted as a fail because of the timeout in Locust.

It's not a JVM startup issue, the other controllers in the same project work just fine. If I use the controller as intended, i.e. with a browser, the POST answers instantly.

This is the relevant part of the Locust file:

self.client.post(  
    url="/stornieren/" + str(buchungs_id),  
    headers=self.headers_stornieren,  
    name="stornieren")  

This is the controller signature:

@PostMapping("/stornieren/{buchungsId}")  
public ModelAndView stornieren(  
     @PathVariable String buchungsId,  
     ModelAndView modelAndView,  
     OidcUser oidcUser) 

Expected: Locust should test this controller in some milliseconds successfully. If there is a problem, Locust and the controller should log them.

Actual: Locust fails after 60s, but visits the returned redirect to the success page. There is no error log whatsoever.

Edit: The former reported problem with breakpoints is flaky, I removed it from the question. I was asked for the debug log, here is:

[2024-01-17 09:15:27,824] (removed)/DEBUG/urllib3.connectionpool: Starting new HTTP connection (2): localhost:8080
send: b'POST /stornieren/a327743d-ed8f-4bde-b086-df7c8018cd55 HTTP/1.1\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\r\nConnection: keep-alive\r\nHost: localhost:8080\r\nAccept-Language: de,en-US;q=0.7,en;q=0.3\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 108\r\nOrigin: http://localhost:8080\r\nReferer: http://localhost:8080/meins\r\nUpgrade-Insecure-Requests: 1\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n\r\n'
reply: 'HTTP/1.1 302 \r\n'
header: X-Content-Type-Options: nosniff
header: X-XSS-Protection: 1; mode=block
header: Cache-Control: no-cache, no-store, max-age=0, must-revalidate
header: Pragma: no-cache
header: Expires: 0
header: X-Frame-Options: DENY
header: Location: http://localhost:8080/stornieren/erfolg
header: Content-Language: de
header: Content-Length: 0
header: Date: Wed, 17 Jan 2024 08:16:31 GMT
header: Keep-Alive: timeout=60
header: Connection: keep-alive
[2024-01-17 09:16:31,345] (removed)/DEBUG/urllib3.connectionpool: http://localhost:8080 "POST /stornieren/a327743d-ed8f-4bde-b086-df7c8018cd55 HTTP/1.1" 302 0
send: b'GET /stornieren/erfolg HTTP/1.1\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8\r\nConnection: keep-alive\r\nHost: localhost:8080\r\nAccept-Language: de,en-US;q=0.7,en;q=0.3\r\nOrigin: http://localhost:8080\r\nReferer: http://localhost:8080/meins\r\nUpgrade-Insecure-Requests: 1\r\nPragma: no-cache\r\nCache-Control: no-cache\r\n\r\n'
reply: ''

Locust statistics of one failed attempt on the POST controller

Locust logs of the failed attempt (URL and server name removed)

Locust statistics of the other POST controller, working normally

0

There are 0 answers