Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 500 with 'Response already ended or closed' #629

Open
daniel-klingensmith-jamf opened this issue Sep 20, 2024 · 2 comments
Open
Assignees

Comments

@daniel-klingensmith-jamf
Copy link

daniel-klingensmith-jamf commented Sep 20, 2024

Full log attached, but after a few requests I'm getting a 500 with IllegalStateException: Response already ended or closed

obfuscated_output.log


| 2024-09-20 20:58:13 WARN i.g.i.s.ResponseServiceImpl - Response file and data are blank for [abac17dd-dde8-4d45-8292-f3eadc7e8ec6] GET http://<url>.lambda-url.us-east-1.on.aws/customer/v2/tenants/12345678-aaaa-bbbb-cccc-0000000000000/state
| 2024-09-20 20:58:13 DEBUG i.g.i.s.ResponseServiceImpl - Returning empty response for [abac17dd-dde8-4d45-8292-f3eadc7e8ec6] GET http://<url>.lambda-url.us-east-1.on.aws/customer/v2/tenants/12345678-aaaa-bbbb-cccc-0000000000000/state
| 2024-09-20 20:58:13 WARN  i.g.i.s.HandlerServiceImpl - File not found: GET http://<url>.lambda-url.us-east-1.on.aws/customer/v2/tenants/12345678-aaaa-bbbb-cccc-0000000000000/state
| 2024-09-20 20:58:13 ERROR i.g.i.a.AbstractHandler - java.lang.IllegalStateException: Response already ended or closed
| 2024-09-20 20:58:13 INFO  i.g.i.a.AbstractHandler - Sending response: [statusCode=500,body=<null>]

Running in AWS with .zip on 4.0.3

Config files
mock-machine.zip

@daniel-klingensmith-jamf daniel-klingensmith-jamf changed the title Getting 500 with Getting 500 with 'Response already ended or closed' Sep 20, 2024
@daniel-klingensmith-jamf
Copy link
Author

I will try to wittle this down to a script that does the minimum required to cause the issue.

@outofcoffee
Copy link
Owner

Hi @daniel-klingensmith-jamf,

Struggling to reproduce this on v4.0.5.

My steps are as follows:

Setup

$ unzip mock-machine.zip
...
$ cd mock-machine
$ ls
jsc                              skyway                           tenant-service
jsc-mocks-config.yaml            skyway-mocks-config.yaml         tenant-service-mocks-config.yaml

Create workspace and configure

$ imposter workspace new test
INFO[0000] created workspace 'test'
$ imposter remote set-type awslambda
INFO[0000] set remote type to 'awslambda' for remote: test
$ imposter remote config anonAccess=true
INFO[0000] set anonAccess for remote: test
$ export AWS_DEFAULT_REGION=eu-west-2
$ export AWS_PROFILE=<my AWS profile>

Deploy

$ imposter remote deploy
INFO[0000] deploying workspace 'test' to awslambda remote
DEBU[0000] using role: arn:aws:iam::000000000000:role/ImposterLambdaExecutionRole
DEBU[0000] downloading https://github.com/outofcoffee/imposter/releases/download/v4.0.5/imposter-awslambda.zip
INFO[0004] bundling 3 files from workspace
DEBU[0004] created deployment package
DEBU[0005] created bucket imposter-mock-876dab5d4d2b4915923e09aec9abbf6f in region eu-west-2
DEBU[0005] bucket imposter-mock-876dab5d4d2b4915923e09aec9abbf6f exists
DEBU[0006] uploaded file /var/folders/vx/zcg6m13956bblwgn6yb4hgsc0000gn/T/imposter-bundle-1157410351.zip to bucket imposter-mock-876dab5d4d2b4915923e09aec9abbf6f
DEBU[0006] creating function: imposter-mock-machine in region: eu-west-2
INFO[0009] created function: imposter-mock-machine with arn: arn:aws:lambda:eu-west-2:000000000000:function:imposter-mock-machine
DEBU[0009] configuring URL for function: arn:aws:lambda:eu-west-2:000000000000:function:imposter-mock-machine
DEBU[0009] configured function URL: https://afzgflhtequubgh5gjseoaj64a0vrdtq.lambda-url.eu-west-2.on.aws/
DEBU[0009] added anonymous URL access permission
INFO[0009] deployed workspace 'test'
Base URL: https://afzgflhtequubgh5gjseoaj64a0vrdtq.lambda-url.eu-west-2.on.aws/
Spec:
Status: https://afzgflhtequubgh5gjseoaj64a0vrdtq.lambda-url.eu-west-2.on.aws/system/status

Testing

Single test

$ curl -v https://afzgflhtequubgh5gjseoaj64a0vrdtq.lambda-url.eu-west-2.on.aws/customer/v2/tenants/12345678-aaaa-bbbb-cccc-0000000000000/state
...
> GET /customer/v2/tenants/12345678-aaaa-bbbb-cccc-0000000000000/state HTTP/1.1
> Host: afzgflhtequubgh5gjseoaj64a0vrdtq.lambda-url.eu-west-2.on.aws
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< Date: Sat, 12 Oct 2024 16:58:54 GMT
< Content-Type: application/json
< Content-Length: 0
< Connection: keep-alive
< x-amzn-RequestId: 5167771b-9963-4a14-9327-9bd2f52a20bc
< x-imposter-request: edf04f8f-a8d3-4c2e-9219-d2c999411dcb
< x-imposter-mocked: true
< x-amzn-Remapped-server: imposter
< X-Amzn-Trace-Id: Root=1-670aaace-2babf7787ff52d9c1a641435;Parent=4a03e23fb3639092;Sampled=0;Lineage=1:06cded30:0
<
* Connection #0 to host afzgflhtequubgh5gjseoaj64a0vrdtq.lambda-url.eu-west-2.on.aws left intact

Test with 200 requests:

$ hey https://afzgflhtequubgh5gjseoaj64a0vrdtq.lambda-url.eu-west-2.on.aws/customer/v2/tenants/12345678-aaaa-bbbb-cccc-0000000000000/state

Summary:
  Total:	6.5214 secs
  Slowest:	6.3363 secs
  Fastest:	0.0167 secs
  Average:	1.4880 secs
  Requests/sec:	30.6681


Response time histogram:
  0.017 [1]	|
  0.649 [150]	|■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  1.281 [0]	|
  1.913 [0]	|
  2.545 [0]	|
  3.177 [0]	|
  3.808 [0]	|
  4.440 [0]	|
  5.072 [0]	|
  5.704 [8]	|■■
  6.336 [41]	|■■■■■■■■■■■


Latency distribution:
  10% in 0.0182 secs
  25% in 0.0201 secs
  50% in 0.0233 secs
  75% in 0.2033 secs
  90% in 6.1322 secs
  95% in 6.2249 secs
  99% in 6.3178 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0114 secs, 0.0167 secs, 6.3363 secs
  DNS-lookup:	0.0047 secs, 0.0000 secs, 0.0201 secs
  req write:	0.0001 secs, 0.0000 secs, 0.0065 secs
  resp wait:	1.4764 secs, 0.0166 secs, 6.3071 secs
  resp read:	0.0000 secs, 0.0000 secs, 0.0001 secs

Status code distribution:
  [200]	200 responses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants