Bug 64427 - --enable-preview no error in log
Summary: --enable-preview no error in log
Status: NEEDINFO
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.x
Hardware: PC All
: P3 minor (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-12 18:11 UTC by Manfred Quasten
Modified: 2020-06-22 11:37 UTC (History)
1 user (show)



Attachments
example stacktrace in jetty (13.72 KB, text/plain)
2020-05-12 18:11 UTC, Manfred Quasten
Details
log with loglevel All (40.64 KB, text/plain)
2020-05-17 07:45 UTC, Manfred Quasten
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Manfred Quasten 2020-05-12 18:11:30 UTC
Created attachment 37236 [details]
example stacktrace  in jetty

The war of a webapplication has been compiled with enable-preview (to be able to use java 14 record). When I put the war into the webapp, tomcat deploys the application. Calling the url nothing happens, not really nothing, I will get an 404 http error.  No error is written in the logs. 

When I set JAVA_OPTS=--enable-preview everything works fine.  I think it would be nice to see the Error in the logs (especially deploying it the first time using preview features with a new java version. Often jetty is used in the development and so you will run into problems deploying it the first time in a tomcat ...

Tomcat 10 its the same
Comment 1 Christopher Schultz 2020-05-12 20:11:07 UTC
So you get nothing in ANY log? Just silently get 404 responses from requests to the context path? Swallowing errors isn't common... :(
Comment 2 Michael Osipov 2020-05-12 23:21:47 UTC
What happens when you enable debug logging? The background processor thread should pick up the WAR file.
Comment 3 Manfred Quasten 2020-05-17 07:43:04 UTC
Using loglevel ALL the stackstrace is in the lock
Comment 4 Manfred Quasten 2020-05-17 07:45:25 UTC
Created attachment 37247 [details]
log with loglevel All
Comment 5 mgrigorov 2020-05-17 11:56:23 UTC
The problem is in https://github.com/apache/tomcat/blob/84d864def79863324456f4ce0fa1039c2a899206/java/org/apache/tomcat/util/ExceptionUtils.java#L32
IMO this method should re-throw any kind of java.lang.Error
Comment 6 Mark Thomas 2020-05-17 13:21:41 UTC
I'm not so sure. The Throwables re-thrown by that method are deliberately very limited. I'd look at the calling code in the first instance. Where is that?
Comment 7 mgrigorov 2020-05-18 06:48:49 UTC
This method looks a lot like Scala's NonFatal extractor: https://github.com/scala/scala/blob/2.13.x/src/library/scala/util/control/NonFatal.scala#L35

I guess there are reasons the list of re-thrown throwables to be this short!
But LinkageError is a pretty serious one. IMO it should be re-thrown.

Probably the method should start with whitelisted Errors, like StackOverflowError, and then re-throw any other kind of Error. But maybe it is too late to make this change.
Comment 8 Mark Thomas 2020-05-19 21:51:51 UTC
I've just tried a basic test and I see a 500 error when I try to access a Servlet that uses a Record when --enable-preview is not enabled.

From the stack trace the application where this error was seen looks to be doing something slightly more complex. Rather than try and reverse engineer things from the stack trace, please can you provide the simplest web application (with source code) that reproduces this error so we can track down exactly what is getting swallowed where and work out the best way to fix it.
Comment 9 Mark Thomas 2020-06-22 11:37:36 UTC
It has been more than a month without the requested reproducible test case being provided. In not test case is provided this issue will eventually be resolved as WORKSFORME.