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

gRPC/Server Returns incorrect 'head' in a batch of messages #188

Closed
2 of 4 tasks
ozobken opened this issue Nov 20, 2018 · 5 comments
Closed
2 of 4 tasks

gRPC/Server Returns incorrect 'head' in a batch of messages #188

ozobken opened this issue Nov 20, 2018 · 5 comments

Comments

@ozobken
Copy link

ozobken commented Nov 20, 2018

Subject of the issue

When retrieving a set of messages via a {sub}, it returns the wrong 'head' for all but the first message

Is this a bug report of a feature request?

  • Bug report
  • Feature request

Your environment

Server-side

  • api.tinode.co
  • Your own setup:
    • platform (Windows, Mac, Linux etc)
    • version of tinode server, e.g. 0.15.2-rc3
    • database backend
      Server 0.15 on Centos with MySQL

Client-side

My prototype IOS App.

I added a header for a timestamp (x--ts), and the header wasn't correctly returned - the batch of messages all had the header from the first message even though the database has stored all the unique headers:

Sending Sub message <ClientMsg 0x600001780370>: {
sub {
id: "12348"
topic: "usr_3K-sfX17UY"
get_query {
what: "data"
data {
}
}
}
}

Ctrl Message - <ServerCtrl 0x600000b90620>: {
id: "12348"
topic: "usr_3K-sfX17UY"
code: 200
text: "ok"
params {
key: "acs"
value: "{"want":"JRWPA","given":"JRWPA","mode":"JRWPA"}"
}
}

Data Message - <ServerData 0x600000e98380>: {
topic: "usr_3K-sfX17UY"
from_user_id: "usr_tVxJkstDpc"
seq_id: 1
head {
key: "x--ts"
value: "20181120113454"
}
content: "redacted"
}
Data Message - <ServerData 0x600000e98380>: {
topic: "usr_3K-sfX17UY"
from_user_id: "usr_tVxJkstDpc"
seq_id: 2
head {
key: "x--ts"
value: "20181120113454"
}
content: "redacted"
}
Data Message - <ServerData 0x600000e9c280>: {
topic: "usr_3K-sfX17UY"
from_user_id: "usr_3K-sfX17UY"
seq_id: 3
head {
key: "x--ts"
value: "20181120113454"
}
content: "redacted"
}
Data Message - <ServerData 0x600000e98380>: {
topic: "usr_3K-sfX17UY"
from_user_id: "usr_tVxJkstDpc"
seq_id: 4
head {
key: "x--ts"
value: "20181120113454"
}
content: "redacted"
}
Data Message - <ServerData 0x600000e98380>: {
topic: "usr_3K-sfX17UY"
from_user_id: "usr_3K-sfX17UY"
seq_id: 5
head {
key: "x--ts"
value: "20181120113454"
}
content: "redacted"
}
Data Message - <ServerData 0x600000e9f780>: {
topic: "usr_3K-sfX17UY"
from_user_id: "usr_3K-sfX17UY"
seq_id: 6
head {
key: "x--ts"
value: "20181120113454"
}
content: "redacted"
}

Ctrl Message - <ServerCtrl 0x600000b904d0>: {
id: "12348"
topic: "usr_3K-sfX17UY"
code: 200
text: "ok"
params {
key: "count"
value: "6"
}
params {
key: "what"
value: ""data""
}
}

@ozobken
Copy link
Author

ozobken commented Nov 20, 2018

I did some more testing to check - and if I request the messages individually, the header is correct, it's only when it returns a batch. Not sure if the bug is in the backend, or in the gRPC interface - the mysql adapter seems to retrieve and StructScan the rows ok, but the 'head' field is getting "cached" somewhere

@or-else
Copy link
Contributor

or-else commented Nov 20, 2018

I'm looking into it.

@or-else
Copy link
Contributor

or-else commented Nov 20, 2018

I cannot reproduce:

$ python3 tn-cli.py --login-basic bob:bob123
Tinode command line client. Version 1.0.0/0.15.9.
Logging in with login:password bob:bob123
Server 'localhost:6061' 
Connected to server: 
	ver: 0.15 
	build: mysql:undef 
201 created 
Authenticated as usrTVxhnBWttIw 
200 ok 
tn-cli> sub usrvfzLXF0MVqw
200 ok  
tn-cli> get --topic=usrvfzLXF0MVqw --data
topic: "usrvfzLXF0MVqw"
from_user_id: "usrTVxhnBWttIw"
seq_id: 1
content: "\"My reply is no\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrTVxhnBWttIw"
seq_id: 2
content: "\"Core Error - Bus Dumped\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrTVxhnBWttIw"
seq_id: 3
content: "\"Courage is something you can never totally own or totally lose.\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrvfzLXF0MVqw"
seq_id: 4
content: "\"Outlook good\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrvfzLXF0MVqw"
seq_id: 5
content: "\"Without a doubt\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrvfzLXF0MVqw"
seq_id: 6
content: "\"Cocaine is nature\'s way of saying you make too much money.\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrTVxhnBWttIw"
seq_id: 7
content: "\"ii\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrTVxhnBWttIw"
seq_id: 8
content: "\"66\""
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrTVxhnBWttIw"
seq_id: 9
head {
  key: "mime"
  value: "\"text/x-drafty\""
}
content: "{\"fmt\":[{\"len\":4,\"tp\":\"ST\"}],\"txt\":\"test\"}"
 
topic: "usrvfzLXF0MVqw"
from_user_id: "usrTVxhnBWttIw"
seq_id: 10
content: "\"aaa\""
 
200 ok 
tn-cli> 

Message 9 has a header, message 10 does not.

@ozobken
Copy link
Author

ozobken commented Nov 20, 2018

I'll test from the python gPRC client on my data and see - maybe it's the Objective-C gRPC interface causing the issue - As I said above - the backend looks right, so it's in the transit somewhere

@or-else
Copy link
Contributor

or-else commented Dec 7, 2018

It's been a while. I assume it's either been resolved or no longer relevant.

@or-else or-else closed this as completed Dec 7, 2018
jimmykuu pushed a commit to jimmykuu/chat that referenced this issue Aug 20, 2019
or-else added a commit that referenced this issue Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants