Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exited event reports exit code 0, when the exit code is 1 for debugee #886

Closed
asmodeus812 opened this issue Mar 5, 2023 · 2 comments
Closed

Comments

@asmodeus812
Copy link
Contributor

asmodeus812 commented Mar 5, 2023

Debug adapter definition and debug configuration

While experimenting with the events and the body they receive, i stumbled upon what might be an adapter issue but still wanted to report it here first. The application below is a simple spring app which i intentionally made to fail, such that it exits with error. In this case the event body reports the exit code is 0 while in actuality it is 1. Note that running the program (jar) from the terminal instead, the process correctly reports exit code 1

interface ExitedEvent extends Event {
  event: 'exited';

  body: {
    /**
     * The exit code returned from the debuggee.
     */
    exitCode: number;
  };
}
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.1)

2023-03-05 08:59:45.792  INFO 5600 --- [           main] com.shit.TestApplication                 : Starting TestApplication using Java 19.0.1 on Asmodeus with PID 5600 (/h
ome/asmodeus/.projects/terere/target/classes started by asmodeus in /home/asmodeus/.projects/terere)
2023-03-05 08:59:45.794  INFO 5600 --- [           main] com.shit.TestApplication                 : No active profile set, falling back to 1 default profile: "default"
2023-03-05 08:59:46.418  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configura
tion mode
2023-03-05 08:59:46.420  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-03-05 08:59:46.430  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 JPA repository
 interfaces.
2023-03-05 08:59:46.468  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configura
tion mode
2023-03-05 08:59:46.468  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
2023-03-05 08:59:46.469  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 0 ms. Found 0 MongoDB reposi
tory interfaces.
2023-03-05 08:59:46.482  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configura
tion mode
2023-03-05 08:59:46.483  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2023-03-05 08:59:46.489  INFO 5600 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 0 ms. Found 0 Redis reposito
ry interfaces.
2023-03-05 08:59:46.743  INFO 5600 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=a07847a1-12f3-3597-b28d-50072cc2df75
2023-03-05 08:59:47.126  INFO 5600 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-03-05 08:59:47.136  INFO 5600 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-03-05 08:59:47.137  INFO 5600 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.64]
2023-03-05 08:59:47.226  INFO 5600 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-03-05 08:59:47.227  INFO 5600 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1381 ms
2023-03-05 08:59:47.508  WARN 5600 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh
 attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourceScriptDatabaseInitializer' defined in class path resour
ce [org/springframework/boot/autoconfigure/sql/init/DataSourceInitializationConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourceScriptDatabaseI
nitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resou
rce [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframewor
k.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springf
ramework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2023-03-05 08:59:47.523  INFO 5600 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-03-05 08:59:47.539  INFO 5600 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-03-05 08:59:47.555 ERROR 5600 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class


Action:

Consider the following:
        If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
        If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


[Process exited 1]

Contents of the event_exited body

{
exitCode = 0,
type = "exited"
}

Debug adapter version

Latest

Steps to Reproduce

  1. Configure dap with nvim-jdtls
  2. Run the default debug configuration / main method without any breakpoints
  3. Let the process execute / finish until it exists
  4. Observe the event body

Expected Result

The exit code is correctly reported

Actual Result

Exit code does not match the debugee's exit code.

@mfussenegger
Copy link
Owner

i stumbled upon what might be an adapter issue

That's correct.

@mfussenegger mfussenegger closed this as not planned Won't fix, can't repro, duplicate, stale Mar 5, 2023
@asmodeus812
Copy link
Contributor Author

asmodeus812 commented Mar 5, 2023

@mfussenegger Are you positive, any additional thoughts ? How should we report that to debug adapter ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants