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
Have the possibility to force disable async archiving in case async archiving is not fully working and we detect it falsely #18090
Comments
refs #13180 @githubyouser Sorry about the trouble. I've had a look through the linked forum post. I think I didn't see any PHP error logs. Any chance you could check them or enable them? Also could you paste a copy of the system report here see https://matomo.org/faq/troubleshooting/how-do-i-find-and-copy-the-system-check-in-matomo-on-premise/ ? |
Thanks, @tsteur. I have enabled PHP logs, but unfortunately, nothing seems to show up relating to my issue. This is all I've got for the past month or so from Matomo. (The 4.3.1 error is from when I downgraded to see if that fixed the problem.)
Let me get my 4.4.1 installation running again here, (I left it in place so I can quickly switch back to it) and I'll get a system report for you shortly. Thanks for looking into this! EDIT: Here's the system check: matomo_system_check.txt |
@tsteur If you need any further information, please don't hesitate to ask. |
Thanks for this @githubyouser It's hard to say what could cause this since it works when executing manually. Is it maybe using a different PHP binary when it's running from the cronjob? Maybe that one has a different php ini? Maybe it helps in the cronjob to define the path to the php binary that you are using when executing it manually. Might make no difference but trying to understand what could be different when executing in cronjob and when manually. Could you maybe remove the cronjob for few hours and then execute it manually to see if you can then reproduce it maybe? |
Thanks @tsteur. I double-checked, and the the path to the PHP binaries is the same. They're also using the same php ini. I removed the cron job and waited a few hours, then ran the archive job manually via SSH, but the task finished in 198 seconds with no errors. Interestingly, my cron job did run once without an error this morning! But I have no idea why, or what the difference was. |
@githubyouser thanks for this update. It's hard to say what's happening there without knowing the system in & out etc. Is there maybe some way that cronjobs are terminated after a while? Possible that it now completed some tasks and next time the cron ran a bit faster and wasn't terminated early. Generally, this looks like a server configuration issue as it works fine when running it manually. I would recommend you look if there are any restrictions for cronjobs. Unfortunately I'm not an expert but maybe you can also check with your hoster etc? |
Thanks for continuing to pursue this with me, @tsteur. I just asked my host about this, and linked to this issue so they can take a look into it. In the mean time, is there any way I can have Matomo put out some more useful debug information? Maybe inject some logging code somewhere to give more precise error messages about what is actually going wrong behind the scenes? |
It's up to you whether you want to upgrade. I would probably recommend as there's always a small chance that it will fix something. Although I don't think it will in this case as it does look like a server configuration issue. Regarding additional logging or so I'm not 100% sure but I would definitely wait first regarding what your hoster says. |
@tsteur here's what my host says: "If Matomo says there were 4 problems or 6 problems or whatever, then it should be able to tell you what they are. A program that exits unsuccessfully without producing a diagnostic error is a broken program. If Matomo can provide useful feedback about some actual problem, we'll be happy to help you look into it." |
thanks for this @githubyouser Did you maybe ask them if there are any kind of restrictions on cronjobs or so? Like a time limit? If there was a logic that simply aborts/kills the process that is being executed, then there wouldn't be much we can log. Currently I don't really think there's actually a problem in Matomo as it seems to work fine when you execute it manually. However, it doesn't seem to work when it runs as a cronjob so there must be some difference. The error message in Matomo says Sorry for all this and lots of forth and back and you being in the middle! It be great to check with them generally if there's any kind of restrictions on the cronjobs (like a time limit) or anything that would explain this. |
I'm pretty sure there's no time limit on cron jobs, as the tasks do eventually finish, it's just that a few of the API calls are empty for some reason.
My host is convinced that it's not their problem, (and said so very emphatically) while you seem to think that it is server-side, so I don't know what to do next! :/ I'll try upgrading in the morning, and if that doesn't work, is there any way we can try to ask Matomo for more debugging info? |
Here's the most recent log from today. As I look closely at it, it seems that all of the requests that are failing are for today's data. Could it be because there's not enough data to process? Some of my sites are very low traffic, and it's possible that they don't have any traffic to report for today. |
Could you try running below command and see if that prints anything?
|
@tsteur do you want this run from a cronjob or just from my SSH commandline? |
I ran it from the command line and got the following response: |
I meant the command line. I see that works. It could be interesting to run it on the crontab too to see if there's any kind of difference. Maybe crontab could run this in say 1-2 hours? I wouldn't run it again right away as it might not give us the result we're after as the reports might not be regenerated |
Here's the response from the cronjob: |
Thanks for this @githubyouser Could you try to edit your [log]
log_writers[] = "file"
log_level = DEBUG This will set the logging to file. You can then later check in There might be also some other logs like the one below which might be expected. I don't know if you can modify your PHP ini settings but you'll also want to check that |
Thanks, @tsteur I've enabled |
@tsteur I'm not seeing any Matomo errors show up in the PHP log. :( |
@githubyouser it might be otherwise good if you could pause the cronjob again for a day and then run it again manually. This should then definitely confirm there is something terminating a process when it's run as cronjob. It's a bit of wild guessing but what might be also worth a try could be to use Otherwise I'm not an expert in Linux. I wonder if there's any kind of logging possible when a process gets suddenly terminated. |
@tsteur I paused the cron job for several hours yesterday, and then ran it with the |
And I just now realized as I look through the logs since enabling the cron job again that I'm now getting a new error message! Could the concurrent-requests option have triggered that, @tsteur? Or maybe that's just a fluke from letting it go several hours without archiving.
EDIT: It looks like that particular error has showed up every few days for the past month or two, but it was always mixed in with the others, and I just never noticed it before. |
Great we're now having some error message there. I found one place where such an error came up in a code for Could you try executing this command? If that causes the issue, there may be a chance actually that there might be an improvement in the already released 4.6.0 beta 1 that would no longer use that command when using |
OK, @tsteur I ran the
|
Thanks. This looks as expected. I have one suspicion. Are you familiar with changing files on the server? If so, could you change the file in private static function awkExistsAndRunsCorrectly()
{
return false;
} |
✨✨ That seems to have done the trick!! The command has run without error via cron for the past 2 hours. I'll definitely keep an eye on it yet, and make sure it's not just a temporary reprieve. 😃 Thanks SO much, @tsteur for helping me work through this! |
@githubyouser I'll reopen it if that's alright just to fully understand a bit more what's happening. Do you mind testing a few more things for us? If you change the |
@tsteur When I change it to |
Thanks for this. There's something wrong in that case potentially with our detection of whether Cli Async Archiving is supported or not. @githubyouser as the change you made that makes the archiving work would be overwritten with the next update, you want as a workaround create a file <?php
return [
'observers.global' => DI\add(array(
array('CliMulti.supportsAsync', DI\value(function (&$supportsAsync) {
$supportsAsync = false;
})),
))
]; This way it should always work for you also when you update to a newer Matomo version. I will update the name of the title to eventually offer a config option to force disable async archiving. |
Interesting would be also to think further why async support was not detect correctly or whether maybe the issue is with something else. The question where is the error |
Thanks, @tsteur. I created the config.php file according to your instructions, so hopefully we won't have any more trouble with it! :) If there's any further troubleshooting I can help with on my installation, please let me know. I'll be happy to help make Matomo better and less buggy! |
I've been experiencing an issue with Matomo
core:archive
scheduled cron jobs throwing "Got invalid response from API request: The response was empty" errors ever since I upgraded to Matomo 4.4.1. Not all of the API requests fail, only a few, and there doesn't seem to be any pattern to which ones fail.My scheduled cron task sends me an email with errors every single time the cron job runs (hourly), until I have ~800 emails from the past few weeks. More details.
Strangely, if I run the exact same command manually via SSH, it will always complete successfully without any errors.
The Error Message
Obviously, I've tried raising the memory limit, but I'm quite sure that's not the real issue, and it didn't make the errors go away.
I've tried debugging further, but neither PHP nor Matomo will log any meaningful errors to shed any more light on the issue. A full summary of what I've tried already and additional info can be found at the Matomo forums: (https://forum.matomo.org/t/uncaught-exception-matomo-core-cronarchive-php-599-got-invalid-response-from-api-request/42849)
Downgrading to Matomo 4.3.1 temporarily solved the problem for me, so I'm stuck using an old version of Matomo until this issue can be resolved. I will be happy to provide any additional details/logs if they would be helpful.
Your Environment
Matomo version: 4.4.1
MySQL version: 10.5.8-MariaDB-1:10.5.8+maria~bionic
PHP version: 7.4.21
Server Operating System: FreeBSD
The text was updated successfully, but these errors were encountered: