0

I'm facing an issue that I can't seem to resolve, as I have difficulty identifying the root cause. I hope to find some help here.

I have a web service coded in Java Spring Boot version 2.7.4, with a simple GET endpoint as an example:

@GetMapping("api/datas/options")
public List<Option> getAllOptions(){
    return pomppdoptRepository.findAll();   
}

I'm trying to send a request to this endpoint using Postman. Here is my Postman configuration:

[https://ibb.co/8n3nfdnP][1]

When I send the request, I do receive a 200 OK response, but when I check my logs, I notice parsing errors.

Logs:

Received [GET /api/datas/options HTTP/1.1
Authorization: Bearer token
User-Agent: PostmanRuntime/7.43.3
Accept: */*
Cache-Control: no-cache
Postman-Token: 57c14232-ed07-4247-a00a-19cf2eb34d5e
Host: localhost:8082
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Cookie: JSESSIONID=90155C405D55A5E7968C4617A05BE184

]

Errors:

2025-04-02 10:07:41.383 DEBUG 24432 --- [nio-8082-exec-5] o.apache.coyote.http11.Http11Processor   : Error parsing HTTP request header

java.io.EOFException: null
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1340) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1227) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:805) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:360) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]
2025-04-02 10:07:41.383 DEBUG 24432 --- [nio-8082-exec-5] o.apache.coyote.http11.Http11Processor   : Error state [CLOSE_CONNECTION_NOW] reported while processing request

java.io.EOFException: null
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1340) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1227) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:805) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:360) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.65.jar:9.0.65]
    at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]

However, if I immediately resend the request, the error does not appear in the logs. But if I wait for a few minutes and try again, the error comes back.

I would like to resolve this issue because I believe it is related to another problem I am facing when linking multiple APIs using async/sync calls. When I send multiple simultaneous requests, I encounter the same issue again.

application.yml

logging:
  level:
    org.apache.coyote.http11: DEBUG
    org.springframework.web: DEBUG
    org.apache.coyote.http11.Http11Processor: DEBUG

server:
  tomcat:
    threads:
      max: 200
      min-spare: 10
    accesslog:
      enabled: true
      pattern: "%h %l %u %t \"%r\" %s %b"
    connection-timeout: 60000  # 60 secondes
    keep-alive-timeout: 60000  # 60 secondes
  port: 8082

spring:
  datasource:
    hikari:
      connection-test-query: SELECT 1
      maximum-pool-size: 20
      minimum-idle: 5
      idle-timeout: 60000
      max-lifetime: 1800000
      connection-timeout: 30000
  jpa:
    show-sql: true
    open-in-view: false
    properties:
      hibernate:
        format_sql: true
    hibernate:
      naming:
        physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
        implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl

Has anyone encountered a similar issue or has an idea on how to resolve this?

2
  • Spring Boot 2.7.4 is pretty old (September 2022). The latest publicly available Spring Boot 2.7.x is 2.7.18 (November 2023). I suggest you update to that version to exclude the possibility this is a bug that was fixed a long time ago. Also consider upgrading to Spring Boot 3 (but that would be more involved). Commented Apr 2 at 9:03
  • @MarkRotteveel I've just upgraded to 2.7.18, but unfortunately this doesn't solve my problem. However, we can now rule out a version problem. Commented Apr 2 at 9:28

1 Answer 1

-1

The key log entry is Error parsing HTTP request header java.io.EOFException.

This indicates Tomcat attempted to read a new HTTP request from the connection but hit an EOF - essentially, the client (Postman in this case) closed the connection while Tomcat was expecting more data.

This can happen when:

  • A connection is reused after being idle for too long (Postman reuses keep-alive connections).

  • A TCP connection was terminated by the client, firewall, proxy, or NAT router due to timeout.

  • The connection was half-closed or reset, but Tomcat wasn’t aware and tried to parse a new request line.

To validate this is the actual issue, please instruct Postman to not keep alive connections:

  • Go to Postman Settings > General and toggle off Use Keep-Alive

  • Or add a Connection: close header manually in your request

This prevents Postman from keeping sockets open and avoids the issue entirely during testing from Postman.

Sign up to request clarification or add additional context in comments.

1 Comment

So, I wasn't able to disable this option in Postman settings, but I modified the header in the Headers section by replacing Connection: keep-alive with Connection: close. Then, I retested by sending multiple requests, and now I get the "parsing HTTP request header" error on every request I send. So, if I send 10 requests, the error message appears 10 times, whereas at first, it only happened on the first request. I don’t understand: if I close the connection, it shouldn't try to reuse an open connection. Instead, it should open and close a new one for each request, right?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.