Skip to content

NPE in ServerImpl reading from no sync input stream #21

@viretp

Description

@viretp

We have a proxy using robaho httpserver (1.0.22). It starts two http servers: the one for the proxy, and one for prometheus scraping endpoint. The server used for prometheus catches a NullPointerException and logs only its name, not it's content and stacktrace, even when we set the log level to FINEST.
We see following output in log:

2025-04-02 07:50:11.995 FINER pool-1-thread-1 robaho.net.httpserver.ServerImpl$Exchange run [http:9999] exchange started [9999.43162]
2025-04-02 07:50:11.995 FINER pool-1-thread-1 robaho.net.httpserver.ServerImpl$Exchange runPerRequest [http:9999] reading request
2025-04-02 07:50:11.995 WARNING pool-1-thread-1 robaho.net.httpserver.ServerImpl$Exchange run [http:9999] ServerImpl unexpected exception
java.lang.NullPointerException
2025-04-02 07:50:11.995 FINER pool-1-thread-1 robaho.net.httpserver.ServerImpl closeConnection [http:9999] closing connection: [9999.43162]

We suppose that the NPE is caused by some network or resource problem.
The same block appears very oft during some time (maybe during 3 seconds or during 15 seconds) when the proxy has actually not even requests to serve, so the JVM has seemingly nothing to do. The same 5 lines are logged like in a loop, 20k times in 3 seconds (!), then no more. During this time, prometheus cannot access the scrape end point. But afterwards it runs smoothly, without a restart...

Is it possible to log more information in case an unexpected exception occurs? In code, the exception is actually logged but strangely we only see the exception class name, nothing more: this is strange, as we use the java util logging and there an exception is typically logged with message and stack trace. Or do you have an idea what occurs with the logging ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions