aws / aws/aws-lambda-base-images
Latest versions of Python Docker Images unexpectedly crashing
- Dominant language
- No language data
- Stars
- 777
- Forks
- 118
- PR merge metrics
- No merged PRs in 30d
Description
The latest docker images for Python (tested with 3.6,3.7,3.8) seem to be crashing unexpectedly. These were previously working for us, but are now failing with an obtuse error. I have reduced the code to the examples from https://docs.aws.amazon.com/lambda/latest/dg/python-image.html .
App code:
```
import sys
def handler(event, context):
return 'Hello from AWS Lambda using Python' + sys.version + '!'
```
Code used to test:
```
import base64
import requests
import json
url = "http://localhost:9000/2015-03-31/functions/function/invocations"
payload ={
}
payload = json.dumps(payload)
response = requests.request("POST", url, data=payload)
print(json.loads(response.text))
```
Dockerfile
```
FROM public.ecr.aws/lambda/python:3.7
COPY app.py ${LAMBDA_TASK_ROOT}
CMD [ "app.handler" ]
```
Error for `public.ecr.aws/lambda/python:3.7` and `public.ecr.aws/lambda/python:3.8`:
```
Creating dockerimage_run ... done
INFO[0055] extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory
WARN[0055] Cannot list external agents error="open /opt/extensions: no such file or directory"
START RequestId: e0ba86fc-e8b1-4498-9d8e-42d6cbe98fdc Version: $LATEST
raise KeyError(key) from Nones.py", line 681, in __getitem__
PANI[0056] ReplyStream not available
2021/08/10 12:27:03 http: panic serving 127.0.0.1:48434: &{0xc00016c000 map[] 2021-08-10 12:27:03.4256262 +0000 UTC m=+56.036990201 panic ReplyStream not available }
goroutine 30 [running]:
net/http.(*conn).serve.func1(0xc0001c20a0)
/usr/local/go/src/net/http/server.go:1800 +0x139
panic(0x866640, 0xc00016c2a0)
/usr/local/go/src/runtime/panic.go:975 +0x3e3
github.com/sirupsen/logrus.Entry.log(0xc00016c000, 0xc000113c80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/go/pkg/mod/github.com/sirupsen/logrus@v1.6.0/entry.go:259 +0x335
github.com/sirupsen/logrus.(*Entry).Log(0xc00016c0e0, 0xc000000000, 0xc0001bb588, 0x1, 0x1)
/go/pkg/mod/github.com/sirupsen/logrus@v1.6.0/entry.go:287 +0xeb
github.com/sirupsen/logrus.(*Logger).Log(0xc00016c000, 0xc000000000, 0xc0001bb588, 0x1, 0x1)
/go/pkg/mod/github.com/sirupsen/logrus@v1.6.0/logger.go:193 +0x7d
github.com/sirupsen/logrus.(*Logger).Panic(...)
/go/pkg/mod/github.com/sirupsen/logrus@v1.6.0/logger.go:234
github.com/sirupsen/logrus.Panic(...)
/go/pkg/mod/github.com/sirupsen/logrus@v1.6.0/exported.go:129
go.amzn.com/lambda/rapi/rendering.RenderInteropError(0x9097c0, 0xc0001882a0, 0xc0001ac500, 0x902b60, 0xc000111340)
/LambdaRuntimeLocal/lambda/rapi/rendering/rendering.go:292 +0x9a
go.amzn.com/lambda/rapi/handler.(*initErrorHandler).ServeHTTP(0xc000111010, 0x9097c0, 0xc0001882a0, 0xc0001ac500)
/LambdaRuntimeLocal/lambda/rapi/handler/initerror.go:52 +0x519
net/http.HandlerFunc.ServeHTTP(0xc000126640, 0x9097c0, 0xc0001882a0, 0xc0001ac500)
/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc000136600, 0x9097c0, 0xc0001882a0, 0xc0001ac500)
/go/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/mux.go:431 +0x278
net/http.HandlerFunc.ServeHTTP(0xc000110fa0, 0x9097c0, 0xc0001882a0, 0xc0001ac500)
/usr/local/go/src/net/http/server.go:2041 +0x44
go.amzn.com/lambda/rapi/middleware.RuntimeReleaseMiddleware.func1.1(0x9097c0, 0xc0001882a0, 0xc0001ac500)
/LambdaRuntimeLocal/lambda/rapi/middleware/middleware.go:100 +0xea
net/http.HandlerFunc.ServeHTTP(0xc000126440, 0x9097c0, 0xc0001882a0, 0xc0001ac500)
/usr/local/go/src/net/http/server.go:2041 +0x44
go.amzn.com/lambda/rapi/middleware.AccessLogMiddleware.func1.1(0x9097c0, 0xc0001882a0, 0xc0001ac500)
/LambdaRuntimeLocal/lambda/rapi/middleware/middleware.go:77 +0x170
net/http.HandlerFunc.ServeHTTP(0xc000126460, 0x9097c0, 0xc0001882a0, 0xc0001ac500)
/usr/local/go/src/net/http/server.go:2041 +0x44
go.amzn.com/lambda/rapi/middleware.AppCtxMiddleware.func1.1(0x9097c0, 0xc0001882a0, 0xc0001ac400)
/LambdaRuntimeLocal/lambda/rapi/middleware/middleware.go:66 +0x77
net/http.HandlerFunc.ServeHTTP(0xc000113410, 0x9097c0, 0xc0001882a0, 0xc0001ac400)
/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc000136600, 0x9097c0, 0xc0001882a0, 0xc0001ac400)
/go/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/mux.go:70 +0x513
github.com/go-chi/chi.(*Mux).Mount.func1(0x9097c0, 0xc0001882a0, 0xc0001ac400)
/go/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/mux.go:298 +0x118
net/http.HandlerFunc.ServeHTTP(0xc0001266a0, 0x9097c0, 0xc0001882a0, 0xc0001ac400)
/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).routeHTTP(0xc0001365a0, 0x9097c0, 0xc0001882a0, 0xc0001ac400)
/go/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/mux.go:431 +0x278
net/http.HandlerFunc.ServeHTTP(0xc000111030, 0x9097c0, 0xc0001882a0, 0xc0001ac400)
/usr/local/go/src/net/http/server.go:2041 +0x44
github.com/go-chi/chi.(*Mux).ServeHTTP(0xc0001365a0, 0x9097c0, 0xc0001882a0, 0xc0001ac300)
/go/pkg/mod/github.com/go-chi/chi@v4.1.2+incompatible/mux.go:86 +0x2b2
net/http.serverHandler.ServeHTTP(0xc0001880e0, 0x9097c0, 0xc0001882a0, 0xc0001ac300)
/usr/local/go/src/net/http/server.go:2836 +0xa3
net/http.(*conn).serve(0xc0001c20a0, 0x90a800, 0xc00019c3c0)
/usr/local/go/src/net/http/server.go:1924 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2962 +0x35c
Traceback (most recent call last):
File "/var/runtime/bootstrap.py", line 335, in main
handler = os.environ["_HANDLER"]
File "/var/lang/lib/python3.7/os.py", line 681, in __getitem__
raise KeyError(key) from None
KeyError: '_HANDLER'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/runtime/bootstrap", line 9, in
main()
File "/var/runtime/bootstrap.py", line 341, in main
lambda_runtime_client.post_init_error(to_json(error_result))
File "/var/runtime/lambda_runtime_client.py", line 48, in post_init_error
response = self.runtime_connection.getresponse()
File "/var/lang/lib/python3.7/http/client.py", line 1373, in getresponse
response.begin()
File "/var/lang/lib/python3.7/http/client.py", line 319, in begin
version, status, reason = self._read_status()
File "/var/lang/lib/python3.7/http/client.py", line 288, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
WARN[0056] First fatal error stored in appctx: Runtime.ExitError
WARN[0056] Process 14(bootstrap) exited: Runtime exited with error: exit status 1
ERRO[0056] Init failed InvokeID= error="Runtime exited with error: exit status 1"
WARN[0056] Failed to send default error response: ErrInvalidInvokeID
ERRO[0056] INIT DONE failed: Runtime.ExitError
WARN[0056] Reset initiated: ReserveFail
```
Is there a Dockerimage stored that we can revert to? or is this a silly error on my part?
Contributor guide
Assessment
This issue has not been assessed yet.