jikan-rest/TROUBLESHOOTING.md

66 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

2019-08-18 15:18:44 +05:00
# Troubleshooting Guide
## My local instance keeps returning HTTP 500
2019-08-18 22:21:27 +05:00
First off, check `storage/logs/lumen.log`.
2019-08-18 15:18:44 +05:00
2019-08-18 22:21:27 +05:00
**1. If you're getting a lot of Redis errors along the lines of `BGSAVE` failing.**
You probably have a low RAM resource, switch over to file caching `CACHE_DRIVER=file`.
2019-08-18 15:18:44 +05:00
Redis throws this error even if you have about 1/4 of your RAM free. This is because it does a background save of your entire Redis cache - which is stored in-memory and which fails without the sufficient required memory.
2019-08-18 22:21:27 +05:00
2021-03-11 03:02:06 -05:00
You can stop Redis from haggling you and override that by running the following command: `redis-cli config set stop-writes-on-bgsave-error no`
2019-08-18 15:18:44 +05:00
2019-08-18 22:21:27 +05:00
**2. Jikan is failing to cache (when `CACHE_DRIVER=file`) because the "disk is out of space" - but you're sure you have enough space available.**
Sorry! This is due to a bug on a previous release ([Issue #59](https://github.com/jikan-me/jikan-rest/issues/59)), please make sure you're upto date.
2019-08-18 15:18:44 +05:00
**Recovery Procedure**
- `sudo service supervisor stop`
2019-08-18 22:21:27 +05:00
- Delete Lumen & worker logs: `rm storage/logs/lumen.log` + `rm storage/logs/worker.log`
- Run `lsof | grep deleted` to check for the "Lumen.log" process, you'll know when it has a bizzare amount of space allocated to the process to it. Copy the process ID and then kill it; `kill [process id]` e.g `kill 12345`
2019-08-18 15:18:44 +05:00
- Make sure your Jikan instance is on the latest release. Run a `git pull` and then `composer update`
- Reduce the number of supervisor processes in `/etc/supervisor/conf.d/jikan-worker.conf` e.g `numprocs=1`
2019-08-18 22:21:27 +05:00
And then reload the supervisor configuration:
`sudo service supervisor start`
`sudo supervisorctl reread`
`sudo supervisorctl reload`
`sudo supervisorctl update`
`sudo supervisorctl start jikan-worker:*`
2019-08-18 15:18:44 +05:00
- Restart everything:
`sudo service supervisor restart`
2019-08-18 22:21:27 +05:00
2019-08-18 15:18:44 +05:00
`sudo service apache2 restart`
2019-08-18 22:21:27 +05:00
2019-08-18 15:18:44 +05:00
`sudo service redis restart`
If Redis is taking too long to restart, follow this: https://stackoverflow.com/a/45069100/2326811 and then start it `sudo service redis start`
2020-05-11 17:40:53 -07:00
## My local instance is returning HTTP 503
This is an error forwarded from MAL, it typically happens when MAL is down. The Jikan response body includes the HTTP status from MAL, like: `[HTTP code] on [request url]`
2019-08-18 15:18:44 +05:00
2019-08-18 22:36:29 +05:00
## I want to clear the cache in Jikan
`php artisan cache:clear`
2019-08-18 15:18:44 +05:00
2019-08-18 22:36:29 +05:00
## I want to clear the Cache Updater Queue
2019-08-19 01:20:36 +05:00
1. `sudo service supervisor stop`
2019-08-18 22:36:44 +05:00
2019-08-19 01:20:36 +05:00
2. `redis-cli --scan --pattern queue_update:* | xargs redis-cli del` or alternatively replace `del` with `unlink` to have it done in the background ([Redis 4.0.0 required](https://redis.io/commands/unlink))
2019-08-18 22:36:29 +05:00
2019-08-19 01:20:36 +05:00
3. `redis-cli --scan --pattern queues:* | xargs redis-cli del` or alternatively replace `del` with `unlink` to have it done in the background ([Redis 4.0.0 required](https://redis.io/commands/unlink))
2019-08-18 22:39:13 +05:00
2019-08-19 01:20:36 +05:00
4. `php artisan queue:restart`
5. `sudo service supervisor start`
2019-08-18 15:18:44 +05:00
2019-08-18 22:39:13 +05:00
2019-08-18 15:18:44 +05:00
More troubleshooting Q/A on the way, please let me know if there's anything else I should add onto here.