Connection prematurely closed BEFORE response #602

Closed
opened 2025-12-29 15:28:01 +01:00 by adam · 3 comments
Owner

Originally created by @sharlinsingh2812 on GitHub (May 24, 2024).

Originally assigned to: @StefH on GitHub.

I am getting the following error:
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
when trying to get the _/_admin/mappings after composing up a docker container with the following image sheyenrath/wiremock.net-alpine:latest. (As of 22 May 2024, the latest was - 1.5.54)

The expected behavior is that a list of mappings should be returned.

Other information:

docker-compose.yaml

services:
  fake-service:
    image: sheyenrath/wiremock.net-alpine:latest
    container_name: fake-service
    volumes:
      - ./mappings.json:/app/__admin/mappings/mappings.json
    command: [
      "dotnet",
      "wiremock-net.dll",
      "--Urls", "http://*:80 http://*:9009",
      "--ReadStaticMappings", "true",
      "--WireMockLogger", "WireMockConsoleLogger",
      "--Port", "9009" ]
    healthcheck:
      test: [ "CMD-SHELL", "wget --spider -O /dev/null localhost:9009/healthz" ]
      interval: 5s
      start_period: 5s
    ports:
      - 9009:9009

GET request

GET /__admin/mappings HTTP/1.1
Host: localhost:9009
###

Response

GET http://localhost:9009/__admin/mappings

reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
Originally created by @sharlinsingh2812 on GitHub (May 24, 2024). Originally assigned to: @StefH on GitHub. I am getting the following error: **reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response** when trying to get the _/__admin/mappings_ after composing up a docker container with the following image **sheyenrath/wiremock.net-alpine:latest**. (As of 22 May 2024, the latest was - [1.5.54](https://hub.docker.com/layers/sheyenrath/wiremock.net/1.5.54/images/sha256-d8f80e3821132b35dc49300289d7a6e84e53cca62e9a65dcedf77b1d678465d0?context=explore)) The expected behavior is that a list of mappings should be returned. ### Other information: docker-compose.yaml ``` services: fake-service: image: sheyenrath/wiremock.net-alpine:latest container_name: fake-service volumes: - ./mappings.json:/app/__admin/mappings/mappings.json command: [ "dotnet", "wiremock-net.dll", "--Urls", "http://*:80 http://*:9009", "--ReadStaticMappings", "true", "--WireMockLogger", "WireMockConsoleLogger", "--Port", "9009" ] healthcheck: test: [ "CMD-SHELL", "wget --spider -O /dev/null localhost:9009/healthz" ] interval: 5s start_period: 5s ports: - 9009:9009 ``` GET request ``` GET /__admin/mappings HTTP/1.1 Host: localhost:9009 ### ``` Response ``` GET http://localhost:9009/__admin/mappings reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response ```
adam added the bug label 2025-12-29 15:28:01 +01:00
adam closed this issue 2025-12-29 15:28:01 +01:00
Author
Owner

@StefH commented on GitHub (May 24, 2024):

Tested on Windows 11

Starting your example works fine:

PS C:\Dev\GitHub\WireMock.Net-docker\Docker Compose Examples\Linux - Alpine 2> docker compose up
[+] Running 1/1
 ✔ Container fake-service  Recreated                                                                                                                                                                                                                   0.1s
Attaching to fake-service
fake-service  | 05/24/2024 08:57:32 [Info] : By Stef Heyenrath (https://github.com/WireMock-Net/WireMock.Net)
fake-service  | 05/24/2024 08:57:32 [Debug] : Server settings {
fake-service  |   "Port": 9009,
fake-service  |   "UseSSL": null,
fake-service  |   "HostingScheme": null,
fake-service  |   "UseHttp2": false,
fake-service  |   "StartAdminInterface": true,
fake-service  |   "ReadStaticMappings": true,
fake-service  |   "WatchStaticMappings": false,
fake-service  |   "WatchStaticMappingsInSubdirectories": false,
fake-service  |   "ProxyAndRecordSettings": null,
fake-service  |   "Urls": null,
fake-service  |   "StartTimeout": 10000,
fake-service  |   "AllowPartialMapping": false,
fake-service  |   "AdminUsername": null,
fake-service  |   "AdminPassword": null,
fake-service  |   "AdminAzureADTenant": null,
fake-service  |   "AdminAzureADAudience": null,
fake-service  |   "RequestLogExpirationDuration": null,
fake-service  |   "MaxRequestLogCount": null,
fake-service  |   "CorsPolicyOptions": 0,
fake-service  |   "AllowCSharpCodeMatcher": false,
fake-service  |   "AllowBodyForAllHttpMethods": false,
fake-service  |   "AllowOnlyDefinedHttpStatusCodeInResponse": false,
fake-service  |   "DisableJsonBodyParsing": false,
fake-service  |   "DisableRequestBodyDecompressing": false,
fake-service  |   "DisableDeserializeFormUrlEncoded": false,
fake-service  |   "HandleRequestsSynchronously": false,
fake-service  |   "CertificateSettings": null,
fake-service  |   "CustomCertificateDefined": false,
fake-service  |   "ClientCertificateMode": 0,
fake-service  |   "AcceptAnyClientCertificate": false,
fake-service  |   "WebhookSettings": null,
fake-service  |   "UseRegexExtended": true,
fake-service  |   "SaveUnmatchedRequests": false,
fake-service  |   "DoNotSaveDynamicResponseInLogEntry": false,
fake-service  |   "QueryParameterMultipleValueSupport": null,
fake-service  |   "ProtoDefinitions": null,
fake-service  |   "GraphQLSchemas": null
fake-service  | }
fake-service  | 05/24/2024 08:57:32 [Info] : Server using .NET 6.0
fake-service  | 05/24/2024 08:57:32 Press Ctrl+C to shut down
fake-service  | 05/24/2024 08:57:32 WireMock.Net server running

Calling Health Point works:

fake-service  | 05/24/2024 08:58:02 [DebugRequestResponse] : Admin[False] {
fake-service  |   "Guid": "2917092b-1407-46c6-9bcf-36c1291988fa",
fake-service  |   "Request": {
fake-service  |     "ClientIP": "::1",
fake-service  |     "DateTime": "2024-05-24T08:58:02.5466137Z",
fake-service  |     "Path": "/healthz",
fake-service  |     "AbsolutePath": "/healthz",
fake-service  |     "Url": "http://localhost:9009/healthz",
fake-service  |     "AbsoluteUrl": "http://localhost:9009/healthz",
fake-service  |     "ProxyUrl": null,
fake-service  |     "Query": {},
fake-service  |     "Method": "GET",
fake-service  |     "HttpVersion": "1.1",
fake-service  |     "Headers": {
fake-service  |       "Connection": [
fake-service  |         "close"
fake-service  |       ],
fake-service  |       "Host": [
fake-service  |         "localhost:9009"
fake-service  |       ],
fake-service  |       "User-Agent": [
fake-service  |         "Wget"
fake-service  |       ]
fake-service  |     },
fake-service  |     "Cookies": {},
fake-service  |     "Body": null,
fake-service  |     "BodyAsJson": null,
fake-service  |     "BodyAsBytes": null,
fake-service  |     "BodyEncoding": null,
fake-service  |     "DetectedBodyType": null,
fake-service  |     "DetectedBodyTypeFromContentType": null
fake-service  |   },
fake-service  |   "Response": {
fake-service  |     "StatusCode": 404,
fake-service  |     "Headers": {
fake-service  |       "Content-Type": [
fake-service  |         "application/json"
fake-service  |       ]
fake-service  |     },
fake-service  |     "BodyDestination": null,
fake-service  |     "Body": null,
fake-service  |     "BodyAsJson": {
fake-service  |       "Guid": null,
fake-service  |       "Status": "No matching mapping found",
fake-service  |       "Error": null
fake-service  |     },
fake-service  |     "BodyAsBytes": null,
fake-service  |     "BodyAsFile": null,
fake-service  |     "BodyAsFileIsCached": null,
fake-service  |     "BodyOriginal": null,
fake-service  |     "BodyEncoding": null,
fake-service  |     "DetectedBodyType": 2,
fake-service  |     "DetectedBodyTypeFromContentType": null,
fake-service  |     "FaultType": null,
fake-service  |     "FaultPercentage": null
fake-service  |   },
fake-service  |   "MappingGuid": null,
fake-service  |   "MappingTitle": null,
fake-service  |   "RequestMatchResult": null,
fake-service  |   "PartialMappingGuid": null,
fake-service  |   "PartialMappingTitle": null,
fake-service  |   "PartialRequestMatchResult": null
fake-service  | }
fake-service  | 05/24/2024 08:58:02 WireMock.Net server running

GET via Chrome works fine:
image

@StefH commented on GitHub (May 24, 2024): _Tested on Windows 11_ Starting your example works fine: ``` PS C:\Dev\GitHub\WireMock.Net-docker\Docker Compose Examples\Linux - Alpine 2> docker compose up [+] Running 1/1 ✔ Container fake-service Recreated 0.1s Attaching to fake-service fake-service | 05/24/2024 08:57:32 [Info] : By Stef Heyenrath (https://github.com/WireMock-Net/WireMock.Net) fake-service | 05/24/2024 08:57:32 [Debug] : Server settings { fake-service | "Port": 9009, fake-service | "UseSSL": null, fake-service | "HostingScheme": null, fake-service | "UseHttp2": false, fake-service | "StartAdminInterface": true, fake-service | "ReadStaticMappings": true, fake-service | "WatchStaticMappings": false, fake-service | "WatchStaticMappingsInSubdirectories": false, fake-service | "ProxyAndRecordSettings": null, fake-service | "Urls": null, fake-service | "StartTimeout": 10000, fake-service | "AllowPartialMapping": false, fake-service | "AdminUsername": null, fake-service | "AdminPassword": null, fake-service | "AdminAzureADTenant": null, fake-service | "AdminAzureADAudience": null, fake-service | "RequestLogExpirationDuration": null, fake-service | "MaxRequestLogCount": null, fake-service | "CorsPolicyOptions": 0, fake-service | "AllowCSharpCodeMatcher": false, fake-service | "AllowBodyForAllHttpMethods": false, fake-service | "AllowOnlyDefinedHttpStatusCodeInResponse": false, fake-service | "DisableJsonBodyParsing": false, fake-service | "DisableRequestBodyDecompressing": false, fake-service | "DisableDeserializeFormUrlEncoded": false, fake-service | "HandleRequestsSynchronously": false, fake-service | "CertificateSettings": null, fake-service | "CustomCertificateDefined": false, fake-service | "ClientCertificateMode": 0, fake-service | "AcceptAnyClientCertificate": false, fake-service | "WebhookSettings": null, fake-service | "UseRegexExtended": true, fake-service | "SaveUnmatchedRequests": false, fake-service | "DoNotSaveDynamicResponseInLogEntry": false, fake-service | "QueryParameterMultipleValueSupport": null, fake-service | "ProtoDefinitions": null, fake-service | "GraphQLSchemas": null fake-service | } fake-service | 05/24/2024 08:57:32 [Info] : Server using .NET 6.0 fake-service | 05/24/2024 08:57:32 Press Ctrl+C to shut down fake-service | 05/24/2024 08:57:32 WireMock.Net server running ``` Calling Health Point works: ``` fake-service | 05/24/2024 08:58:02 [DebugRequestResponse] : Admin[False] { fake-service | "Guid": "2917092b-1407-46c6-9bcf-36c1291988fa", fake-service | "Request": { fake-service | "ClientIP": "::1", fake-service | "DateTime": "2024-05-24T08:58:02.5466137Z", fake-service | "Path": "/healthz", fake-service | "AbsolutePath": "/healthz", fake-service | "Url": "http://localhost:9009/healthz", fake-service | "AbsoluteUrl": "http://localhost:9009/healthz", fake-service | "ProxyUrl": null, fake-service | "Query": {}, fake-service | "Method": "GET", fake-service | "HttpVersion": "1.1", fake-service | "Headers": { fake-service | "Connection": [ fake-service | "close" fake-service | ], fake-service | "Host": [ fake-service | "localhost:9009" fake-service | ], fake-service | "User-Agent": [ fake-service | "Wget" fake-service | ] fake-service | }, fake-service | "Cookies": {}, fake-service | "Body": null, fake-service | "BodyAsJson": null, fake-service | "BodyAsBytes": null, fake-service | "BodyEncoding": null, fake-service | "DetectedBodyType": null, fake-service | "DetectedBodyTypeFromContentType": null fake-service | }, fake-service | "Response": { fake-service | "StatusCode": 404, fake-service | "Headers": { fake-service | "Content-Type": [ fake-service | "application/json" fake-service | ] fake-service | }, fake-service | "BodyDestination": null, fake-service | "Body": null, fake-service | "BodyAsJson": { fake-service | "Guid": null, fake-service | "Status": "No matching mapping found", fake-service | "Error": null fake-service | }, fake-service | "BodyAsBytes": null, fake-service | "BodyAsFile": null, fake-service | "BodyAsFileIsCached": null, fake-service | "BodyOriginal": null, fake-service | "BodyEncoding": null, fake-service | "DetectedBodyType": 2, fake-service | "DetectedBodyTypeFromContentType": null, fake-service | "FaultType": null, fake-service | "FaultPercentage": null fake-service | }, fake-service | "MappingGuid": null, fake-service | "MappingTitle": null, fake-service | "RequestMatchResult": null, fake-service | "PartialMappingGuid": null, fake-service | "PartialMappingTitle": null, fake-service | "PartialRequestMatchResult": null fake-service | } fake-service | 05/24/2024 08:58:02 WireMock.Net server running ``` GET via Chrome works fine: ![image](https://github.com/WireMock-Net/WireMock.Net/assets/249938/cba87d6b-b26e-423a-ac64-25d1c8e5dfd6)
Author
Owner

@sharlinsingh2812 commented on GitHub (May 24, 2024):

Thanks Stef Heyenrat

Looks like a newer/updated image for v1.5.54 was pushed to Docker Hub. (May 22, 2024).
I was using the image v1.5.54 that was pushed on May 19,2024)

Not getting the issue anymore.

@sharlinsingh2812 commented on GitHub (May 24, 2024): Thanks [Stef Heyenrat](https://github.com/StefH) Looks like a newer/updated image for v1.5.54 was pushed to Docker Hub. (May 22, 2024). I was using the image v1.5.54 that was pushed on May 19,2024) Not getting the issue anymore.
Author
Owner

@StefH commented on GitHub (May 24, 2024):

Fixed with this indeed:

1.5.55 (22 May 2024)

  • #1107 When only Port is provided, bind to * (Fixes #1100) [bug]
@StefH commented on GitHub (May 24, 2024): Fixed with this indeed: # 1.5.55 (22 May 2024) - #1107 When only Port is provided, bind to * (Fixes #1100) [bug]
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#602