justanhduc / task-spooler

A scheduler for GPU/CPU tasks
https://justanhduc.github.io/2021/02/03/Task-Spooler.html
GNU General Public License v2.0
273 stars 24 forks source link

TS_SOCKET file not created when called by php shell_exec #65

Closed ffallah closed 1 week ago

ffallah commented 1 week ago

I am executing ts from my php script : shell_exec("TS_SOCKET=/tmp/queue7 /usr/local/bin/ts echo 444444"); It queues the command successfuly but /tmp/queue7 is not created and I can not query which commands have been queued because socket file doesnt exist. The strange thing is that, /tmp/queue7 is present in lsof output for the ts process which is created:

COMMAND    PID   USER   FD   TYPE             DEVICE SIZE/OFF    NODE NAME
ts      351289 apache  cwd    DIR                9,2     4096  917589 /tmp
ts      351289 apache  rtd    DIR                9,2     4096       2 /
ts      351289 apache  txt    REG                9,2   367112  426513 /usr/local/bin/ts
ts      351289 apache  mem    REG                9,2  2592552  405699 /usr/lib64/libc.so.6
ts      351289 apache  mem    REG                9,2   861816  409597 /usr/lib64/ld-linux-x86-64.so.2
ts      351289 apache    0u  unix 0xffff9538d997e1c0      0t0 7858576 /tmp/queue7 type=STREAM (LISTEN)
ts      351289 apache    3u  unix 0xffff95390e46fb40      0t0 7821944 type=STREAM (CONNECTED)
ts      351289 apache    4u  unix 0xffff9538dbb55500      0t0 7843248 /run/php-fpm/www.sock type=STREAM (CONNECTED)
ts      351289 apache    9u  unix 0xffff953932107700      0t0 7818769 /run/php-fpm/www.sock type=STREAM (LISTEN)

but it doesnt exist in /tmp folder.

ffallah commented 1 week ago

I found the culprit. php has its own /tmp folder managed by systemd here : /tmp/systemd-private-b2e586dfbf9c4a088d020efd21beb1cc-php-fpm.service-mBQbCu/tmp