Skip to content

Davmail does not exit when socket bind failed #438

@Nils-TUD

Description

@Nils-TUD

When the bind of the server socket fails, davmail does not exit. For example:

Using system provided JRE
openjdk version "25.0.1" 2025-10-21
OpenJDK Runtime Environment (build 25.0.1)
OpenJDK 64-Bit Server VM (build 25.0.1, mixed mode, sharing)
2026-01-18 09:04:39,495 DEBUG [main] davmail.DavGateway  - Start DavMail in server mode
2026-01-18 09:04:39,514 ERROR [main] davmail  - Unable to bind server socket for CALDAV on port 25000: port not allowed or in use by another process

I would expect davmail to exit with a proper error code in such cases. Is there a reason why it doesn't do that? Because I don't see any point in letting davmail continue afterwards as nobody can connect to it. Am I missing something?

The reason why it matters is that I am using davmail programmatically in another application and this behavior makes it really hard to handle errors properly. The only way I see currently is to parse davmail's output to detect that, but this is really hard to do reliably.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions