Skip to content
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

Messenger: Message not delivered #383

Closed
brightrim opened this issue Oct 20, 2023 · 3 comments
Closed

Messenger: Message not delivered #383

brightrim opened this issue Oct 20, 2023 · 3 comments
Assignees
Labels
bug A feature does not operate in the intended way.

Comments

@brightrim
Copy link
Member

https://discord.com/channels/401855954272124940/1164920049635696671 discord bug report thread

Issue:
Character logged on after longer duration of not being around receives inform about a message, but receives no message.

Log of the incident shows that there are indeed no messages sent when there should be, with no sender listed and no message:

1 Oct 20 15:30:42 Script (info): [Messenger]: REDACTED_RECIPIENT_NAME at (668, 296, 0) has received 0 messages. They contain the following, garbled for privacy reasons: 

Log of tests done after where the messenger worked as intended, for comparison of what it should look like:

Oct 20 16:19:45 Script (info): [Messenger]: REDACTED_RECIPIENT_NAME at (725, 770, 0) has received 1 messages. They contain the following, garbled for privacy reasons: (Sender 1: REDACTED_SENDER_NAME Message1: (****t************)

1 Oct 20 16:21:49 Script (info): [Messenger]: REDACTED_RECIPIENT_NAME at (725, 770, 0) has received 1 messages. They contain the following, garbled for privacy reasons: (Sender 1:  REDACTED_SENDER_NAME Message1: (****t****t****)****�)

The character receiving an inform and the log appearing means that the script gets past the check of the scriptVar recipient.id.."storedMessages", which stores the amount of messages stored for the character.
The number of messages being 0 in the log, means that either one or multiple pieces of stored data in the scriptVar is missing, checked for in the following line:

        local foundText1, text1 = ScriptVars:find(recipient.id.."storedMessageText"..i)
        local foundText2, text2 = ScriptVars:find(recipient.id.."storedMessageText2"..i)
        local foundText3, text3 = ScriptVars:find(recipient.id.."storedMessageText3"..i)
        local foundText4, text4 = ScriptVars:find(recipient.id.."storedMessageText4"..i)
        local foundSignature, signature = ScriptVars:find(recipient.id.."storedMessageSignature"..i)
        local foundDescriptionEn, descriptionEn = ScriptVars:find(recipient.id.."storedMessageDescriptionEn"..i)
        local foundDescriptionDe, descriptionDe = ScriptVars:find(recipient.id.."storedMessageDescriptionDe"..i)

        if foundText1 and foundText2 and foundText3 and foundText4 and foundSignature and foundDescriptionEn and foundDescriptionDe then

I can not check the database for whether these variables exist or if any are missing for this particular player. Would require someone with access to privacy-sensitive information about players such as @slightlycomatose or @estralis, but due to the testing done above to see if the character was able to receive messages at all, any relevant information will unfortunately have already been overwritten by those messages.
I will for now put in a hotfix for additional logging of these particular variables to see exactly which ones are not found the next time this happens, assuming it happens again, in an effort to narrow it down further, as I unfortunately have not discovered any way to reproduce the issue for testing possible solutions or causes.

@brightrim brightrim added the bug A feature does not operate in the intended way. label Oct 20, 2023
@brightrim brightrim self-assigned this Oct 20, 2023
@brightrim
Copy link
Member Author

/usr/share/illarion/scripts/content/messenger.lua:160: attempt to perform arithmetic on a nil value

1 Jan 6 16:35:49 Script (info): Message 1 out of 1 to be received by REDACTED failed to be sent. Texts found: true false false false Signature found: true Descriptions found: true true

1 Jan 6 16:35:49 Script (info): 1 messages meant for REDACTED failed to send!

@brightrim
Copy link
Member Author

Improved the logs for now to provide any details I could think of to help narrow this down next time. I still have no clue what is causing this. As a bonus, it should now be easier to read what each part of the script does as I segmented it and added more comments.

@brightrim
Copy link
Member Author

Given it some more thought and another look, I believe I have solved this by making a work around if the empty text2-4 that should return as empty for short messages instead return as false due to not being found, based on the inform that said the three texts after the first one failed to be found. Not sure why the messages normally work but have the three texts show up as empty on rare occasion, but it always seems to happen after the server has been rebuilt so perhaps that deleted empty "" database entries so that they can no longer be found. Regardless I think it is resolved now so I will close the issue and only re-open it if it should happen again in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A feature does not operate in the intended way.
Projects
None yet
Development

No branches or pull requests

1 participant