API Intermittently Returning Empty Set

The exact same call to Actions.getPageUrl will 4/5 times return correctly. But the other 1/5 times all I get back is an empty result. This happens without any paramters being changed.

When the Empty Response happens, there’s no error message displayed, logged to error_log, or anywhere else that I can find. I don’t have any idea how to proceed with debugging this issue.’

Can I turn on more verbose debugging some how?

Lastly, I am not able to reproduce this issue on the demo site.

Example request:


Normal Response (80% of the time):

    "label": "\/foo",
    "nb_visits": 3,
    "nb_hits": 7,
    "sum_time_spent": 2109,
    "entry_nb_visits": 3,
    "entry_nb_actions": 34,
    "entry_sum_visit_length": 6450,
    "entry_bounce_count": 0,
    "exit_nb_visits": 2,
    "sum_daily_nb_uniq_visitors": 3,
    "sum_daily_entry_nb_uniq_visitors": 3,
    "sum_daily_exit_nb_uniq_visitors": 2,
    "avg_time_on_page": 703,
    "bounce_rate": "0%",
    "exit_rate": "67%",
    "url": "http:\/\/example.com\/foo"

Empty Response (20% of the time)


Two updates…

[li] Changing the period parameter from period=2001-01-01,today to period=2013-05-01,today causes the occurence rate of the empty set response to decrease dramatically (to approximately 1/50 requests). However, the problem still occurs.
[/li][li] I have discovered the log_messages config directive, and have captured two logs. One for a successful response, and one for when the empty set is returned. They’re included in pastebin links below.

Successful Run Log: [2013-05-23 20:36:31] [d6133811] [1.52 Mb] Processing range (From 2013-05-01 to - Pastebin.com

Empty Set Run Log: [2013-05-23 20:39:23] [b6e8a9d6] [1.52 Mb] Already processed, fetching idArchive - Pastebin.com

I can’t see anything significantly different enough between the two runs, but perhaps someone more familiar with Piwik might notice something.

Have you setup Piwik as explained in: How to Set up Auto-Archiving of Your Reports - Analytics Platform - Matomo
in particular, disable browser triggered archiving should help

I had not disabled browser triggered archiving. I didn’t expect API requests to count as a ‘browser trigger’.

This morning I disabled browser triggered archiving and it appears that when I ran the cron task, it happened to result in one of the empty set responses, which was then cached. So EVERY Request was coming back as an empty set.

Without waiting for the timeout to expire, the only way I could get an expected (non-empty set) result was to re-enable browser triggered archiving.

So caching isn’t going to fix this problem for me. I really need to figure out why the exact-same query sometimes results in a [ ] response.

FYI - This problem continues for me with Piwik 1.12-b19.

Some further server details…

[li] Ubuntu 13.04
[/li][li] MySQL 5.5.31
[/li][li] PHP 5.4.9

Can you increase timeout in General settings, to ie. 3600 ?

This was the value I set the timeout to when I said I had disabled browser triggering.

Again, adding caching doesn’t seem to be a valid way to address the problem that sometimes the results to the exact same query returns an empty-set.

Indeed, try upgrade to latest mysql, php, web server, it may help. otherwise monitor the server error log for any new things