Skip to content

Commit 18dd0c2

Browse files
committed
Fix recording shutdown for node docker
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
1 parent 5e2fa13 commit 18dd0c2

5 files changed

Lines changed: 11 additions & 4 deletions

File tree

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,7 @@ test_node_docker: hub standalone_docker standalone_chrome standalone_firefox sta
11701170
echo UID=$$(id -u) >> .env ; \
11711171
echo BINDING_VERSION=$(BINDING_VERSION) >> .env ; \
11721172
echo BASE_VERSION=$(BASE_VERSION) >> .env ; \
1173+
echo VIDEO_EVENT_DRIVEN=$(or $(VIDEO_EVENT_DRIVEN), "true") >> .env ; \
11731174
if [ "$$(uname)" != "Darwin" ]; then \
11741175
echo HOST_IP=$$(hostname -I | awk '{print $$1}') >> .env ; \
11751176
else \
@@ -1238,7 +1239,7 @@ test_video_integrity:
12381239
fi; \
12391240
for file in $$list_files; do \
12401241
echo "Checking video file: $$file"; \
1241-
docker run -u $$(id -u) -v $$(pwd):$$(pwd) -w $$(pwd) --entrypoint="" $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) ffmpeg -v error -i "$$file" -f null - ; \
1242+
docker run --rm -u $$(id -u) -v $$(pwd):$$(pwd) -w $$(pwd) --entrypoint="" $(NAME)/video:$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) ffmpeg -v error -i "$$file" -f null - ; \
12421243
if [ $$? -ne 0 ]; then \
12431244
echo "Video file $$file is corrupted"; \
12441245
number_corrupted_files=$$((number_corrupted_files+1)); \

Video/recorder.conf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ autostart=%(ENV_SE_RECORD_VIDEO)s
66
startsecs=0
77
autorestart=%(ENV_SE_RECORD_VIDEO)s
88
stopsignal=TERM
9-
stopwaitsecs=60
9+
stopwaitsecs=30
1010

1111
;Logs (all activity redirected to stdout so it can be seen through "docker logs"
1212
redirect_stderr=true
@@ -20,7 +20,8 @@ killasgroup=true
2020
autostart=%(ENV_SE_RECORD_VIDEO)s
2121
startsecs=0
2222
autorestart=%(ENV_SE_RECORD_VIDEO)s
23-
stopsignal=KILL
23+
stopsignal=TERM
24+
stopwaitsecs=5
2425

2526
;Logs (all activity redirected to stdout so it can be seen through "docker logs"
2627
redirect_stderr=true

Video/video_ready.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ def do_GET(self):
2828

2929
def graceful_shutdown(signum, frame):
3030
print("Trapped SIGTERM/SIGINT/x so shutting down video-ready...")
31-
httpd.shutdown()
31+
# httpd.shutdown() must be called from a different thread than serve_forever()
32+
# or it deadlocks. video-ready has no state to drain, so close the socket
33+
# and exit directly — supervisord will see the clean exit immediately.
34+
httpd.server_close()
3235
sys.exit(0)
3336

3437

tests/docker-compose-v3-test-node-docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
- SE_OPTS=--enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
2222
- SE_BROWSER_ARGS_DISABLE_DSHM=--disable-dev-shm-usage
2323
- SE_LOG_LEVEL=${LOG_LEVEL}
24+
- SE_VIDEO_EVENT_DRIVEN=${VIDEO_EVENT_DRIVEN}
2425
- SE_VIDEO_RECORD_STANDALONE=true
2526
- SE_VIDEO_FILE_NAME=${VIDEO_FILE_NAME}
2627
- SE_VIDEO_FILE_NAME_SUFFIX=${VIDEO_FILE_NAME_SUFFIX}

tests/docker-compose-v3-test-standalone-docker.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ services:
1414
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
1515
- SE_NODE_GRID_URL=${GRID_URL}
1616
- SE_OPTS=--log-level ${LOG_LEVEL} --enable-managed-downloads ${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
17+
- SE_VIDEO_EVENT_DRIVEN=${VIDEO_EVENT_DRIVEN}
1718
- SE_VIDEO_RECORD_STANDALONE=${RECORD_STANDALONE}
1819
- SE_VIDEO_FILE_NAME=${VIDEO_FILE_NAME}
1920
- SE_VIDEO_FILE_NAME_SUFFIX=${VIDEO_FILE_NAME_SUFFIX}

0 commit comments

Comments
 (0)