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

ERROR "Failed to set current task contexttx is closed" #541

Closed
drenbutkovic opened this issue Feb 23, 2023 · 5 comments · Fixed by #542
Closed

ERROR "Failed to set current task contexttx is closed" #541

drenbutkovic opened this issue Feb 23, 2023 · 5 comments · Fixed by #542
Assignees
Labels
🐞 bug Something isn't working

Comments

@drenbutkovic
Copy link

Hi,
error "Failed to set current task contexttx is closed" is logged in table timetable.log when task is configured to be executed on external database.
The task is completed successfully, but an error is shown in the log.
The task from the example is executed every minute, but the behavior is the same for tasks that are started in some other periods.
If the task is defined in a way that it is executed on the same DB where is pg_timetable then there is no error in log.
ERROR message is between messages "Remote connection established..." and "Closing remote session".

Timetable database and external database is on same Postgres cluster.
Timetable version: pg_timetable:5.1
OS: CentOS Linux release 7.9.2009 (Core)
Postgres: PostgreSQL 11.11

Task definition
task_definition

database_connection is in format
postgres://username:password@ipaddress:port/database_name?sslmode=disable

Chain definition
chain_definition

Logs from execution_log table
execution_log

Logs from log table
logs

All podman logs for one chain.
podman_logs_chain_147.txt

pg_timetable service
pg_timetable_v5_service_podman_conf.txt

@pashagolub pashagolub self-assigned this Feb 23, 2023
@pashagolub pashagolub added the 🐞 bug Something isn't working label Feb 23, 2023
@pashagolub
Copy link
Collaborator

Hello. Thanks for your request.

Would you, please, be so kind to add --log-level=debug start parameter and provide the output here.
File /etc/systemd/system/pg_timetable_v5.service will look like this probably:

[Unit]
Description=pg_timetable
Wants=network.target postgresql-11.service
After=network-online.target postgresql-11.service

[Service]
Restart=on-failure
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid
ExecStart=/usr/bin/podman run --conmon-pidfile  /%t/%n-pid  --cidfile /%t/%n-cid -d --name pg_timetable-v5 \
-e PGTT_PGHOST=192.168.50.97 \
-e PGTT_PGPORT=5432 \
-e PGTT_PGDATABASE=timetablev5 \
-e PGTT_PGUSER=timetable \
-e PGTT_PGPASSWORD=xxxxx \
-e PGTT_RESTPORT=8111 \
--net=host \
-p 8111:8111 \
-v /etc/localtime:/etc/localtime:ro \
cybertecpostgresql/pg_timetable:5.1 \
-c umbosspm --log-level=debug
ExecStop=/usr/bin/sh -c "/usr/bin/podman rm -f `cat /%t/%n-cid`"
KillMode=none
Type=forking
PIDFile=/%t/%n-pid

[Install]
WantedBy=multi-user.target

Thanks in advance.

@drenbutkovic
Copy link
Author

Hi,
log file is in attachment.
Only one chain is active for test purpose.
Chain no. 147 is configured to run_at every minute, cron * * * * *

pg_timetable_debug_chain_147.txt

Tanks for fast response.

@pashagolub
Copy link
Collaborator

Would you please check patched version. The docker image is cybertecpostgresql/pg_timetable:IS541

Thanks in advance!

@drenbutkovic
Copy link
Author

Hi,
after patch IS541, there are no more ERROR logs in table log.

logs_after_patch

debug logs
pg_timetable_IS541_debug_chain_147.txt

Thanks.

@pashagolub
Copy link
Collaborator

Nice! Thanks for your report!

pashagolub added a commit that referenced this issue Feb 23, 2023
…set-current-task-contexttx-is-closed

[-] fix executor context for pgengine.SetCurrentTaskContext(), fixes #541
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
2 participants