-
Notifications
You must be signed in to change notification settings - Fork 147
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
Sporadic Message Errors #1055
Comments
Ok, gave it some more thinking, can it be that the message model is missing an: |
…oodcoops#1055" This reverts commit bcde771.
I wrapped now the messages create controller in debug log level and and just look at the following lines which are the sql insert statements created for a short time window, first it produces the correct sql and suddenly it produces 4 times in a row the wrong: It includes 2 additional fields, recipients_ids (which should actually by a method provided by ApplicationRecord) and email_state which is actually a field from MessageRecipient. |
This are the logs from more or less the same message once it worked and the other time it didn't. |
I'm really stuck here, actually this seems to be really old code and suddenly it creates that strange behavior. And it is happening rather often so it is starting to get really troublesome. |
Hm... to be honest, for now, I have no clue 😟 I also cannot reproduce this locally - maybe it's some issue only occurring with certain production environment settings. @yksflip Have you ever experienced this error on your servers? It seems like some kind of rails association caching bug to me, so maybe upgrading rails' (or some other component's) patch version might help. I couldn't find a rails issue for this on GitHub though. What you could try, is add this temporary line at the top of Rails.logger.info "---TMP DUMMY: #{Message.first.recipients.first.id}" In the best case, this could even somehow force rails to reload the missing association config before trying to save the message. In the worst case it would throw a similar error three lines earlier. |
this sounds really tricky. I haven't heard of this issue before. I cannot make any sense why it tries to write @lentschi I don't quite understand why this might be a association caching bug, could you maybe explain this? The association is called |
Yes, but there's the
So my only guess for now is that active records' associations get confused somehow. (Maybe depending on the order of importing some plugin or whatever... 🤷 ) I'm afraid, I don't have too much time to investigate right now. Should the bug still be there come Friday, I can try to debug. |
Debugged a little more but still couldn't find a lead. 😟 @mortbauer What we could also add a debug log for is |
Thank you for looking into it, but I think I got rid of the problem with these two commits, |
Since I upgraded our foodsoft to 4.8.1 users are reporting problems sending messages, I could also reproduce it once, after restarting the server the problem was gone in my case.
I was also able to isolate the logs for one such problem (I removed the message body because I think it is unrelated):
Another pattern seems to be that it only occurs for answers to messages or creating messages to ordergoups.
I do not really get it for now since recipient_ids obviously shouldn't hit the db, however it seems it does.
The text was updated successfully, but these errors were encountered: