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

Messages are not always correctly send #35

Closed
LEDfan opened this issue Jul 12, 2017 · 15 comments
Closed

Messages are not always correctly send #35

LEDfan opened this issue Jul 12, 2017 · 15 comments
Assignees
Labels
Milestone

Comments

@LEDfan
Copy link
Member

LEDfan commented Jul 12, 2017

As reported by @Schmuuu , @Nils160988 and on help.nextcloud.com some Chat messages are not correctly send and/or retrieved.

I cannot reproduce it, but it would be very good if we can fix this.

To anyone who is experiencing this problem can you provide the following information:

  • Nextcloud version
  • Database vendor (e.g. MySQL, postgres, sqlite)
  • Browser version
  • Are you using any special user names
  • User backend (e.g. default, LDAP etc)
  • Are you using multiple domains to access your Nextcloud?

Can you also set the loglevel of Nextcloud to 0 ('loglevel' => 0, in config/config.php), install the build provided in #34 and then put the nextcloud.log here. Please make sure any personal information is removed since all usernames, presence and chat messages will be logged.

Thanks!

@LEDfan LEDfan added the bug label Jul 12, 2017
@LEDfan LEDfan self-assigned this Jul 12, 2017
@sualko
Copy link
Member

sualko commented Jul 12, 2017

Maybe it's also a good idea to enable debugging in jsxc and check if something arrives in your js console (ctrl+shift+I).

@Schmuuu
Copy link

Schmuuu commented Jul 12, 2017

Hi @LEDfan

I ran your new build and collected the Nextcloud log with Debug level. Can I send the log file to you via private message somehow.

  • NC: 12 stable release
  • Database: MySQL 5.7.18
  • PHP Version: 7.0.18
  • Special Usernames? All users only contain only [A-Za-z_]
  • Browser Firefox 54.0.1 and MS Edge latest Version
  • User backend: default (no LDAP or anything like that)
  • Multiple domains? No, only one domain
  • nginx is used as proxy (Nextcloud/ Onlyoffice)
  • apache 2.4.18 used for Nextcloud
  • followed hardening steps in docu to receive A+ in nextcloud security scanner

Browser console:

  • https://domain.com/apps/ojsxc/http-bind : Unable to run script because scripts are blocked internally. (unknown)
  • XML-Processing Error: not well-formed address: row Nr. 1, Column 120: (unknown):1:120
  • TypeError: jsxc.xmpp.conn is null
  • "This website seems to use a scroll-linked positioning effect. This could possibly work with async moving(?) (Panning) badly; see https://developer.mozilla.org/docs/Mozilla/Performance/ScrollLinkedEffects For more details take part in the developer discussions! LEDfan"
  • Cross-Origin Request blocked: Die Gleiche-Quelle-Regel verbietet das Lesen der externen Ressource auf https://collector.githubapp.com/collect. (Grund: Berechtigung/Credential wird nicht unterstützt, wenn die CORS-Kopfzeile 'Access-Control-Allow-Origin' auf '*' gesetzt ist).

Hope this helps

@sualko
Copy link
Member

sualko commented Jul 12, 2017

XML-Processing Error: not well-formed address: row Nr. 1, Column 120: (unknown):1:120

This sounds interesting. If you have debugging enabled, you should see the stanza which triggers this message. Can you post it?

@Schmuuu
Copy link

Schmuuu commented Jul 12, 2017

Right now I don't have time for debugging and relating this message to log entries. However I would like to send you the nextcloud log via private message. Is there a possibility?

@LEDfan
Copy link
Member Author

LEDfan commented Jul 12, 2017 via email

@LEDfan
Copy link
Member Author

LEDfan commented Jul 13, 2017

So after filtering and looking at the log, I noticed that the chat messages are stored in the database so that they can be retrieved by the recipient. However the recipient never retrieves them. So there are a couple scenario's possible:

  1. the stanza is deleted from the database before the user can retrieve it.
  2. between executing the DB query and saving them to send them to the client the messages are lost.

Can you execute the following query on your database please (it's possible that you have to change the oc_ part by another prefix.

SELECT * FROM ojsxc_stanzas ORDER BY id DESC LIMIT 20

If the query returns nothing you can try to sent some messages (but make sure the other user is online).

Thanks for the debugging!

@LEDfan
Copy link
Member Author

LEDfan commented Jul 13, 2017

Just installed mysql 5.7 and then it still works for me...

@Schmuuu
Copy link

Schmuuu commented Jul 14, 2017

Hi @LEDfan

I ran the SQL querys:

mysql> select * from oc_ojsxc_stanzas order by id desc limit 20; +-----+----------+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | id | from | to | stanza | +-----+----------+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 357 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965cbc8344f0-msg"><body xmlns="jabber:client">talk to me</body><request xmlns="urn:xmpp:receipts"></request><active xmlns="http://jabber.org/protocol/chatstates"></active></message> | | 356 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965cb8115751-msg"><body xmlns="jabber:client">Another test</body><request xmlns="urn:xmpp:receipts"></request><active xmlns="http://jabber.org/protocol/chatstates"></active></message> | | 355 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965cb55c09d9-msg"><body xmlns="jabber:client">Test</body><request xmlns="urn:xmpp:receipts"></request><active xmlns="http://jabber.org/protocol/chatstates"></active></message> | | 354 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965cb54a257e-msg"><composing xmlns="http://jabber.org/protocol/chatstates"></composing></message> | | 353 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965ca8b9a9b2-msg"><body xmlns="jabber:client">I don't receive your messages neither</body><request xmlns="urn:xmpp:receipts"></request><active xmlns="http://jabber.org/protocol/chatstates"></active></message> | | 352 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965ca8a8fb75-msg"><paused xmlns="http://jabber.org/protocol/chatstates"></paused></message> | | 351 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965ca88047f8-msg"><composing xmlns="http://jabber.org/protocol/chatstates"></composing></message> | | 350 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965ca86dcb4b-msg"><paused xmlns="http://jabber.org/protocol/chatstates"></paused></message> | | 349 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965ca817ebf5-msg"><composing xmlns="http://jabber.org/protocol/chatstates"></composing></message> | | 348 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965ca80f0037-msg"><paused xmlns="http://jabber.org/protocol/chatstates"></paused></message> | | 347 | User1 | user2 | <message to="user2" from="User1" type="chat" xmlns="jabber:client" id="5965ca7ef0b33-msg"><composing xmlns="http://jabber.org/protocol/chatstates"></composing></message> | | 344 | User2 | user1 | <message to="user1" from="User2" type="chat" xmlns="jabber:client" id="5965ca4d37ef9-msg"><body xmlns="jabber:client">nothing?</body><request xmlns="urn:xmpp:receipts"></request><active xmlns="http://jabber.org/protocol/chatstates"></active></message> | | 343 | User2 | user1 | <message to="user1" from="User2" type="chat" xmlns="jabber:client" id="5965ca4d27a23-msg"><paused xmlns="http://jabber.org/protocol/chatstates"></paused></message> | | 342 | User2 | user1 | <message to="user1" from="User2" type="chat" xmlns="jabber:client" id="5965ca4d151bf-msg"><body xmlns="jabber:client">Hello there?!</body><request xmlns="urn:xmpp:receipts"></request><active xmlns="http://jabber.org/protocol/chatstates"></active></message> | | 341 | User2 | user1 | <message to="user1" from="User2" type="chat" xmlns="jabber:client" id="5965ca42a33aa-msg"><composing xmlns="http://jabber.org/protocol/chatstates"></composing></message> | | 340 | User2 | user1 | <message to="user1" from="User2" type="chat" xmlns="jabber:client" id="5965ca4264c89-msg"><paused xmlns="http://jabber.org/protocol/chatstates"></paused></message> | | 336 | ncadmin | user2 | <message to="user2" from="ncadmin" type="chat" xmlns="jabber:client" id="5965ca20e322e-msg"><paused xmlns="http://jabber.org/protocol/chatstates"></paused></message> | | 335 | ncadmin | user2 | <message to="user2" from="ncadmin" type="chat" xmlns="jabber:client" id="5965ca2028791-msg"><composing xmlns="http://jabber.org/protocol/chatstates"></composing></message> | | 334 | ncadmin | user2 | <message to="user2" from="ncadmin" type="chat" xmlns="jabber:client" id="5965ca201df3f-msg"><paused xmlns="http://jabber.org/protocol/chatstates"></paused></message> | | 333 | ncadmin | user2 | <message to="user2" from="ncadmin" type="chat" xmlns="jabber:client" id="5965ca1d4e50c-msg"><composing xmlns="http://jabber.org/protocol/chatstates"></composing></message>

Is it possible, that the reason, why no-one else except the admin receives the messages is, because the admin is the only user whose name doesn't start with a capital letter? Please note the difference above. The "from" column always contains the user names as they really exist in the DB: with a capital letter as first letter. Only the admin user doesn't have a capital letter at all in his name. The "to" column however always contains the usernames written in small letters (and this is only correct for the admin). Not sure if you use a function like toLower or something like that to still have a correct match. Just wanted to point that out.

And to be clear: in the above output I replaced the usernames case sensitive like I found them in the output. So let's say there is a user "Peter", then I replaced "Peter" with "User1" and "peter" with "user1". The admin user is simply "ncadmin" with all small letters.

If it is working for you and still not for me, could the reason be, that I have a migrated system? I started with NC 10 and migrated up to NC 12 now.

Are there any further internal connections? Thinking about what could be the difference between our servers, it just came to my mind that I use fail2ban and maybe there is something blocked?

And you are very welcome! I rather have to thank you, for taking the time to analyze my problem and helping me to solve it :) Thanks a lot for that!
I really hope it is not my fault by a stupid mistake :S

@LEDfan
Copy link
Member Author

LEDfan commented Jul 14, 2017

Yep that will be it probably, we have had problems with the casing of usernames before. I was only testing with usernames in all lower letters. And I only tested to login with a username which has another casing, but that bug was already fixed. I'll patch this ASAP :)

@sualko sualko modified the milestone: 3.3.0 Jul 14, 2017
@Nils160988
Copy link

Thanks a lot. This is probably the same reason for the issues with my nextcloud/chat instance, because most of our users have capital letters.
I can find the same database entries.

@Schmuuu
Copy link

Schmuuu commented Jul 14, 2017

Well I thought about it again and while I still hope that we found the root cause to be the capital letters, I already doubt it :(
The admin user can have chats with every other user currently (on my server) but only the "normal" users can't.
So if
"from ncadmin to user1"
works, why doesn't
"from User2 to user1"

On the other hand it didn't work to promote User1 to be an admin as well. He still can only chat with the admin.
I wanted to run another test with a new user "demo" (without capital letters), but because the latest debug version didn't have the "roster update"(?) fix I didn't see the new created user in the chat user list :(

Let's hope LEDfan can fix it ;)

@LEDfan
Copy link
Member Author

LEDfan commented Jul 15, 2017

So I added the fix to #33 for easier debugging. A build is available there.

@Schmuuu
Copy link

Schmuuu commented Jul 17, 2017

Hi @LEDfan

Sorry for the late response, I had a busy weekend. Nonetheless, yesterday at night I managed to run a test with the new build you provided.
Great job, you fixed it! 👍 :)

All users received all the messages that haven't been transmitted yet :D

Thanks a lot!

@Nils160988
Copy link

I can confirm that the new build is working :)
All messages are delivered.

@LEDfan
Copy link
Member Author

LEDfan commented Jul 18, 2017

I'm really happy to hear that 😃 !

@sualko sualko closed this as completed in 0a0c6ce Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants