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
Do not use CliMulti archiving strategy if ps does not show current process #13114
Conversation
Hi @blankse (in theory the message would be displayed when there was an empty response so it shouldn't hide information. and it's on purpose to run in the background so we could run multiple at once) |
Hi @mattab Before:
After:
But than we don't know if the sub command is successfull. We have empty reports because of memory limit errors. When the commands should be async, it should be a mechanism, which look with a timeout after the contents in the tmp files. |
This is how it's supposed to work already, the code is in core/CliMulti.php Maybe something didn't work in your case but in theory it should work fine? |
@mattab I looked deeper. The Proccess creates a *.pid File with the PID. This PID is generated by the CliMulti class and is passed to the command in the query argument. I think the command ignore this PID. So the PID is not in the RunningProcesses List and the process instantly finished. How is this PID query argument working? |
@mattab I found it. The RequestCommand writes the getmypid() in the file and remove it at the end of the process. We get running processes over |
Hi @blankse thanks for updating the PR! I looked at the code and I'm not sure if this is the cause of your issue. RequestCommand doesn't receive a pid, but the name of the pid file (see https://github.com/matomo-org/matomo/blob/3.x-dev/core/CliMulti.php#L311). RequestCommand will check if the file exists & is not empty, so it doesn't execute Can you confirm that the RequestCommand command exits immediately after starting? |
@diosmosis The CliMulti class create a empty pid file and give the name with the query to the RequestCommand. The RequestCommand writes its PID in this file: The CliMulti check this file (Empty = not started, Full and in the proccess list = started, Full and not in the proccess list = finished) My system can not load the own proccesses. So it thinks the RequestCommand is immediately |
@blankse If RequestCommand writes the PID to the file, then I would expect CliMulti would read the contents successfully. Or are you saying that when RequestCommand writes Btw, what system are you running matomo on? Maybe I can try and reproduce. |
@diosmosis The RequestCommand can write its PID in the file. CliMulti can read this PID successfully. But in the ProcessList (which is loaded with It is a managed hosting with Linux Gentoo. |
I haven't tested it but by the looks it makes sense 👍 |
@tsteur But CliMulti executes |
To me it just sounds good that when the process doesn't find its own pid in the list of processes, something is likely wrong/ not supported. I presume in general that |
A reasonable hypothesis. But adding this check might create confusion later on as it suggests the parent process needs to know the child process' PID. I believe this problem merits further investigation. It would be good to know the root cause. But then @blankse may not have time to dig any deeper so there may not be an opportunity to look further. |
In the core:archive command I get following message for every site:
After looking in the code I found following solution.
The sub commands are executed in the background with the & sign.
The output file doesn't exists when it is looking for content.