rnwood / smtp4dev

smtp4dev - the fake smtp email server for development and testing
BSD 3-Clause "New" or "Revised" License
2.97k stars 334 forks source link

Connecting.... Error: No Connection with that ID: Status code '404' #1450

Open odombrovska opened 3 months ago

odombrovska commented 3 months ago

We had smtp4dev running in a Docker container in our k8s cluster for like 6 months or so, no issues. For some reason now in the UI I see it erroring:

image

Screenshot 2024-04-29 182743

We had 3.1.4, so I decided to give it an update and bumped it to 3.4.0 thinking that will resolve it - no luck.

In the logs of the container itself I don't see anything suspicious:

smtp4dev version 3.4.0+6a02795ece04ee6d805a6c5c99e9848a2c23cd52
https://github.com/rnwood/smtp4dev
.NET Core runtime version: .NET 8.0.2

 > For help use argument --help

Install location: C:\
DataDir: smtp4dev
Default settings file: C:\app\appsettings.json
User settings file: smtp4dev\appsettings.json
Parsing AutomaticRelayExpression
Parsing CredentialsValidationExpression
Parsing RecipientValidationExpression
Parsing MessageValidationExpression
Using Sqlite database at C:\smtp4dev\database.db
Updating DB schema with migrations: 20181020095712_InitialCreate, 20181021072518_AddSessionToMessageReln, 20181021105259_AddSessionStartData, 20181022132948_AddSessionErrorInfo, 20181022163054_AddAttachmentCount, 20190310130227_AddMessageUnreadFlag, 20200904135503_AddRelayError, 20200924120747_AddImapState, 20210211134331_AddMessageSecurity, 20210731045851_UTCTimeMigration, 20210807032903_MessageRelay, 20210901140449_Fix_Messages_PK, 20240308081358_AddSessionEncoding, 20240309084542_AddMessageEightBitTransport, 20240425190525_AddMailboxes
Creating mailbox Default
TLS mode: None
SMTP Server is listening on port 25 (::).
Keeping last 50 messages per mailbox and 50 sessions.
IMAP Server is listening on port 143 (::)
Now listening on: http://[::]:80

I can see messages get received and processed in the logs. I don't see a single message in the UI though, it just throws the errors above, indicating that there's a connection problem of some sort. I've no idea what it might want to function properly again. We didn't introduce anything networking-wise etc, so any suggestion would be appreciated! Thanks.

rnwood commented 3 months ago

If you know how, can you hit F12 and see what response the call to /api/messages is getting.

The error above just means that your client terminated the connection without politely QUITing first. Nothing to worry about (maybe we should reconsider this being shown unless connection is dropped mid transaction).


From: olha d. @.> Sent: Monday, April 29, 2024 5:32:04 PM To: rnwood/smtp4dev @.> Cc: Subscribed @.***> Subject: [rnwood/smtp4dev] Connection issue (Issue #1450)

We had smtp4dev running in a Docker container in our k8s cluster for like 6 months or so, no issues. For some reason now in the UI I see it erroring:

image.png (view on web)https://github.com/rnwood/smtp4dev/assets/77400214/8fd2cf8a-5843-4c1e-86d0-79c98231c8aa Screenshot.2024-04-29.182743.png (view on web)https://github.com/rnwood/smtp4dev/assets/77400214/1ad01ca4-74cb-4887-acd4-5b5d2d1134fb

In the logs of the container itself I don't see anything suspicious:

smtp4dev version 3.4.0+6a02795ece04ee6d805a6c5c99e9848a2c23cd52 https://github.com/rnwood/smtp4dev .NET Core runtime version: .NET 8.0.2

For help use argument --help

Install location: C: DataDir: smtp4dev Default settings file: C:\app\appsettings.json User settings file: smtp4dev\appsettings.json Parsing AutomaticRelayExpression Parsing CredentialsValidationExpression Parsing RecipientValidationExpression Parsing MessageValidationExpression Using Sqlite database at C:\smtp4dev\database.db Updating DB schema with migrations: 20181020095712_InitialCreate, 20181021072518_AddSessionToMessageReln, 20181021105259_AddSessionStartData, 20181022132948_AddSessionErrorInfo, 20181022163054_AddAttachmentCount, 20190310130227_AddMessageUnreadFlag, 20200904135503_AddRelayError, 20200924120747_AddImapState, 20210211134331_AddMessageSecurity, 20210731045851_UTCTimeMigration, 20210807032903_MessageRelay, 20210901140449_Fix_Messages_PK, 20240308081358_AddSessionEncoding, 20240309084542_AddMessageEightBitTransport, 20240425190525_AddMailboxes Creating mailbox Default TLS mode: None SMTP Server is listening on port 25 (::). Keeping last 50 messages per mailbox and 50 sessions. IMAP Server is listening on port 143 (::) Now listening on: http://[::]:80

I can see messages get received and processed. I don't see a single message in the UI, it just throws the errors above. I've no idea what it might want to function properly again. We didn't introduce anything networking-wise etc, so any suggestion would be appreciated! Thanks.

— Reply to this email directly, view it on GitHubhttps://github.com/rnwood/smtp4dev/issues/1450, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKEGF2JOUBQBDWKNYR2OKTY7ZYYJAVCNFSM6AAAAABG6VEWCWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DSNBXGIZDCNQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

odombrovska commented 3 months ago

Hi, here you go, both /api/messages and the failing one:

Screenshot 2024-04-29 195050 Screenshot 2024-04-29 195206

There are no messages displayed in the UI, so that is a bit worrisome to me, cause before we were able to see them.

rnwood commented 3 months ago

Looks like you are running at /smtp. Are you using the smtp4dev basepath option for this or is a reverse proxy rewriting?

The notifications 404 looks wrong, but that only drives the auto refresh and you should have an error showing in the header about this. Can you confirm if you see the messages if you refresh manually?


From: olha d. @.> Sent: Monday, April 29, 2024 6:54:58 PM To: rnwood/smtp4dev @.> Cc: Robert Wood @.>; Comment @.> Subject: Re: [rnwood/smtp4dev] Connecting.... Error: No Connection with that ID: Status code '404' (Issue #1450)

Hi, here you go, both /api/messages and the failing one: Screenshot.2024-04-29.195050.jpg (view on web)https://github.com/rnwood/smtp4dev/assets/77400214/4ee70c1e-480f-42b7-b75c-35413c08f385 Screenshot.2024-04-29.195206.jpg (view on web)https://github.com/rnwood/smtp4dev/assets/77400214/909c507f-78a4-4d4c-baec-e56bdd71a664

— Reply to this email directly, view it on GitHubhttps://github.com/rnwood/smtp4dev/issues/1450#issuecomment-2083320179, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAKEGF4UCMAVEDG5VZCWWLDY72CPFAVCNFSM6AAAAABG6VEWCWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGMZDAMJXHE. You are receiving this because you commented.Message ID: @.***>

odombrovska commented 3 months ago

I don't see the messages when refreshing manually.

These are the only env variables I supply to the container:


        - name: ServerOptions__Hostname
          value: abc.xyz.net
        - name: ServerOptions__BasePath
          value: /smtp
        - name: ServerOptions__Port
          value: "25"
        - name: ServerOptions__NumberOfMessagesToKeep
          value: "50"
        - name: ServerOptions__NumberOfSessionsToKeep
          value: "50"

And here are ingress and service that expose the UI and make port 25 available for the server, just for reference:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    appgw.ingress.kubernetes.io/appgw-ssl-certificate: wildcard-net
    appgw.ingress.kubernetes.io/backend-protocol: http
    appgw.ingress.kubernetes.io/request-timeout: "240"
    appgw.ingress.kubernetes.io/ssl-redirect: "true"
  name: smtp-ingress
spec:
  ingressClassName: azure-application-gateway
  rules:
  - host: abc.xyz.net
    http:
      paths:
      - backend:
          service:
            name: smtp-service
            port:
              number: 80
        path: /smtp
        pathType: Prefix

--- 

apiVersion: v1
kind: Service
metadata:
  name: smtp-service
spec:
  ports:
  - name: smtp
    port: 25
    protocol: TCP
    targetPort: 25
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: smtp
odombrovska commented 3 months ago

I can see a bunch of sessions in the 'Sessions' tab as well as some messages info, but the messages never appear in the 'Messages' tab itself:

Screenshot 2024-04-29 204801

rnwood commented 3 months ago

This is the Windows container image I believe? (based on seeing c:\).

Is there just a single instance/replica of this container or are you running more than one?

odombrovska commented 3 months ago

Just a single replica, and yes, it's a Windows image