502 Bad gateway

Good morning!

I’m working on a project and we are facing issues trying to get the views on the products using the method ‘getItemsSku’ with a pattern.

Here is the link:
Link

why could this be happening?

Thanks in advance.

Have a look in your server logs (nginx logs and php-fpm logs).

Yes, and they show nothing wrong.
The weird part is that now, its working sometimes and other times are not working. I’m so confused.

Could it be a timeout (e.g. 30s) from PHP maybe?

If its a timeout it should show a 504 time out error right?

edit: I think it has something to do with the pattern, when i remove the filter_pattern it shows all the products.

https://piwik.teachwise.com/index.php?&period=range&date=2014-09-17,2015-01-14&idSite=1&token_auth=bc61f99150796266ce4dadd0581d7454&format=json&filter_limit=-1&module=API&method=Goals.getItemsSku

This is the error on the piwik server:
2015/01/19 18:35:13 [error] 11075#0: *1324764 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.71.12, server: , request: “GET /index.php?&period=range&idSite=1&date=2014-08-18,2015-01-19&token_auth=bc61f99150796266ce4dadd0581d7454&format=json&filter_limit=-1&module=API&method=Goals.getItemsSku&filter_pattern=C0000474-181-WRW-G012 HTTP/1.0”, upstream: “fastcgi://unix:/var/run/php5-fpm-www.sock:”, host: “piwik.teachwise.com

Any ideas?

Ah sorry I mixed up 502 and 504, indeed it doesn’t seem to be a timeout, especially since the link you gave errors after 2-3s.

Can you try what is suggested here: php - failed (104: Connection reset by peer) - Stack Overflow (i.e. enable catch_workers_output) and see if the logs have more information then?

The issue is fixed now!

We updated the servers from PHP 5.3 to 5.4.34. Thanks for the help Matthieu!

Thanks for letting us know, at least we can suggest that if someone else has the same problem :wink: