[SOLVED] JLinkGDBServer doens't mark socket as reusable

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] JLinkGDBServer doens't mark socket as reusable

    If I ctrl-c the GDB server to quit it I have to wait a while because the kernel keeps the socket listening for a while afterward because the SO_REUSEADDR option was not set on the listen sockets.

    Can this be changed? It's tedious to have to wait for it :(

    The post was edited 1 time, last by Darius ().

  • Hi,

    I forwarded this request to the maintainer of the J-Link GDB Server.
    (EDIT: He is on vacation this week, so please do not expect an answer to soon)

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Hi,

    This has been removed on purpose, because it caused problems when starting multiple instances of GDBServer.
    Details will follow.
    However, I do not think we can easily change it back without causing ourselves trouble with other customers.
    Easiest solution is to just not kill GDBServer and close it properly...

    If you want to close GDBServer automatically after the debug session, you can specify this with the "singlerun" command line option.


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • SEGGER - Alex wrote:

    Hi,

    This has been removed on purpose, because it caused problems when starting multiple instances of GDBServer.
    Details will follow.


    OK.. Not sure why that would be since they would have to run on different port numbers so it shouldn't matter.

    SEGGER - Alex wrote:


    However, I do not think we can easily change it back without causing ourselves trouble with other customers.
    Easiest solution is to just not kill GDBServer and close it properly...

    If you want to close GDBServer automatically after the debug session, you can specify this with the "singlerun" command line option.


    OK thanks for the suggestion.

    After posting this I found a sysctl (net.ipv4.tcp_tw_recycle) which tells the kernel to allow reuse of sockets in TIME_WAIT.

    Also, I found quitting gdb as well as GDB server fixed it, but that is suboptimal from a user experience PoV. Related to this - the monitor does not understand the 'detach' command which makes using it more awkward than it needs to be.