Karaf
  1. Karaf
  2. KARAF-1410

Error in stop script if KARAF_DEBUG is enabled

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.6
    • Fix Version/s: 2.2.8, 2.3.0, 3.0.0
    • Labels:
      None
    • Environment:

      Tested under Linux but problem exists also under Windows

      Description

      While trying to use the stop script in order to shut down my Karaf instance (2.2.6) with the debug option enabled I have encountered the following error:

      karaf: Enabling Java debug options: -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005
      ERROR: transport error 202: bind failed: Address already in use
      ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
      JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
      FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
      Aborted

      The problem is that stop script calls karaf script which tries to execute a new Java process with DEBUG option enabled to the same port.

      1. unix-karaf-diff.txt
        0.2 kB
        Nikolaos Dimos

        Activity

        Hide
        Jean-Baptiste Onofré added a comment -

        It makes sense Dan, I will update in that way.

        Show
        Jean-Baptiste Onofré added a comment - It makes sense Dan, I will update in that way.
        Hide
        Dan Stolz added a comment -

        You need to handle the case for the client.bat script as well.
        I was going to propose separate ports for each type (although that would still fail if you tried to launch client.bat twice, which should be allowed).
        I think a better solution would be to only set the debug options for running as 'server'.

        Show
        Dan Stolz added a comment - You need to handle the case for the client.bat script as well. I was going to propose separate ports for each type (although that would still fail if you tried to launch client.bat twice, which should be allowed). I think a better solution would be to only set the debug options for running as 'server'.
        Hide
        Jean-Baptiste Onofré added a comment -

        I'm updating the karaf.bat script as well (for Windows users who have the same issue).

        Show
        Jean-Baptiste Onofré added a comment - I'm updating the karaf.bat script as well (for Windows users who have the same issue).
        Hide
        Andreas Pieber added a comment -

        +1 from my point of view on applying this patch. looks pretty good to me since the usecases where you need debug here anyhow are quite limited.

        Show
        Andreas Pieber added a comment - +1 from my point of view on applying this patch. looks pretty good to me since the usecases where you need debug here anyhow are quite limited.
        Hide
        Nikolaos Dimos added a comment -

        Attached you can find the diff of the karaf script patched to ignore the setDebugOptions function in case of stop argument.

        Show
        Nikolaos Dimos added a comment - Attached you can find the diff of the karaf script patched to ignore the setDebugOptions function in case of stop argument.

          People

          • Assignee:
            Jean-Baptiste Onofré
            Reporter:
            Nikolaos Dimos
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development