Karm / mandrel-integration-tests

Integration tests for GraalVM and its Mandrel distribution. Runs Quarkus, Helidon and Micronaut applications and small targeted reproducers. The focus is solely on native-image utility and compilation of Java applications into native executables.
Apache License 2.0
5 stars 3 forks source link

DebugSymbolsTest.debugSymbolsQuarkus fails with latest GraalVM master #154

Closed jerboaa closed 1 year ago

jerboaa commented 1 year ago

debugSymbolsSmokeGDB fails with (both with Java 17 and Java 20):

Error:  Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 724.231 s <<< FAILURE! - in org.graalvm.tests.integration.DebugSymbolsTest
Error:  debugSymbolsQuarkus{TestInfo}  Time elapsed: 543.363 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: 
There were errors in the GDB session. Note that commands in the session might depend on each other. Errors: 
Command 'b ConfigTestController.java:33' did not match the expected pattern '.*Breakpoint 1 at .*: file com/example/quarkus/config/ConfigTestController.java, line 33.*'.
Output was:
(gdb) (gdb) (gdb) GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
 ==> expected: <true> but was: <false>
    at org.graalvm.tests.integration.DebugSymbolsTest.carryOutGDBSession(DebugSymbolsTest.java:394)
    at org.graalvm.tests.integration.DebugSymbolsTest.debugSymbolsQuarkus(DebugSymbolsTest.java:219)

Error:  debugSymbolsSmokeGDB{TestInfo}  Time elapsed: 180.857 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: 
There were errors in the GDB session. Note that commands in the session might depend on each other. Errors: 
Command 'break Main.java:71' did not match the expected pattern '.*Breakpoint 2 at .*: file debug_symbols_smoke/Main.java, line 71.*'.
Output was:
(gdb) Breakpoint 2 at 0x55555569bcf0: file debug_symbols_smoke/Main.java, line 76.
, 
Command 'c' did not match the expected pattern '.*Breakpoint 3, debug_symbols_smoke.Main::main.*at debug_symbols_smoke/Main.java:76.*String l = sc.nextLine\(\);.*'.
Output was:
(gdb) Continuing.

Thread 1 "debug-symbols-s" hit Breakpoint 2, debug_symbols_smoke.Main::main(java.lang.String[]*) (args=<optimized out>) at debug_symbols_smoke/Main.java:76
76                  String l = sc.nextLine();
, 
Command 'c' did not match the expected pattern '.*Breakpoint 2, debug_symbols_smoke.Main::main.*at debug_symbols_smoke/Main.java:71.* if \(myString != null.*'.
Output was:
(gdb) Continuing.
fdc7c50f390c145bc58a0bedbe5e6d2e35177ac73d12e2b23df149ce496a5572
[Thread 0x7ffff7d68740 (LWP 9357) exited]
[Thread 0x7ffff737f640 (LWP 9358) exited]
[New process 9357]
[Inferior 1 (process 9357) exited normally]
, 
Command 'c' did not match the expected pattern '.*Breakpoint 2, debug_symbols_smoke.Main::main.*at debug_symbols_smoke/Main.java:71.* if \(myString != null.*'.
Output was:
(gdb) The program is not being run.
, 
Command 'c' did not match the expected pattern '.*fdc7c50f390c145bc58a0bedbe5e6d2e35177ac73d12e2b23df149ce496a5572.*exited normally.*'.
Output was:
(gdb) (gdb) The program is not being run.
 ==> expected: <true> but was: <false>
    at org.graalvm.tests.integration.DebugSymbolsTest.carryOutGDBSession(DebugSymbolsTest.java:394)
    at org.graalvm.tests.integration.DebugSymbolsTest.debugSymbolsSmokeGDB(DebugSymbolsTest.java:137)

Latest passing run was https://github.com/graalvm/mandrel/actions/runs/4878221407/jobs/8703969691 (4 days ago). The github image runner in both cases is Image: ubuntu-22.04 Version: 20230426.1 indicating this is not due to a change in the github runners (e.g. gdb version)

jerboaa commented 1 year ago

See: https://github.com/graalvm/mandrel/actions/runs/4898986169/jobs/8748948579#step:10:19206 https://github.com/graalvm/mandrel/actions/runs/4910500117/jobs/8768028502#step:10:19184

jerboaa commented 1 year ago

Copying from: https://github.com/Karm/mandrel-integration-tests/issues/102#issuecomment-1538167651

The regression was introduced with https://github.com/oracle/graal/pull/6504 and more specifically by https://github.com/oracle/graal/commit/b70c6402d6b37e74e4f5c9df4f83ecfafc84c82f

It's also worth noting that https://github.com/oracle/graal/commit/00eaa8ea09a001b61346cf6c0418b62dde08d29c makes -H:-OmitInlinedMethodDebugLineInfo the default.

The above changes result in making the breakpoint appear in a different line (even with -H:+OmitInlinedMethodDebugLineInfo). Further investigation is required to see if this is an upstream issue.

zakkak commented 1 year ago

The regression is due to defaulting to not using SourceMappings when building the CompilationResultTree. This choice was made in order to improve build times, but as expected it comes at the cost of less accurate generated code to source mapping.

Building the native image with -H:+DebugCodeInfoUseSourceMappings brings back the old behavior.

This doesn't look like an upstream bug, but we probably want:

  1. to add this flag to Quarkus when creating debug builds.
  2. test both with and without the flag

@Karm @jerboaa thoughts?

jerboaa commented 1 year ago

Building the native image with -H:+DebugCodeInfoUseSourceMappings brings back the old behavior.

This doesn't look like an upstream bug, but we probably want:

1. to add this flag to Quarkus when creating debug builds.

That seems fine. We'll have to add to the debugtest for the non-quarkus app as well, though.

2. test both with and without the flag

Like test it as two variations of the debug info tests? Not sure if it's worth it.

jerboaa commented 1 year ago

Re-opening this until the quarkus fix is in.