Found the problem. The database is inconsistent!!! The inconsistency has arisen due to a rare BUG that was in the script earlier and I was the first to be victimised.
OK, now something started to make sense. The database is screwed up since the time when I tried to purge users and it did not work on my server. Hence the COUNT of user or userID in the tables email_users and email_dgraph is not the same. Thats the problem.
In the logs it can be seen clearly that it gets killed because it cannot execute the query. The Query cannot be executed because it HAS_HAS_HAS to query in both the tables. In both the tables the user does not match.
So in the table email_users, the user entry of userID 132 does exists and there is no entry in the dgraph about this user.
Hence there needs to be something changed. It cannot query both the tables, but only the email_users.
Why should it Query the table dgraph also? Thats the problem.
How and where should I change it?