dequis / purple-facebook

Facebook protocol plugin for libpurple (moved from jgeboski/purple-facebook)
GNU General Public License v2.0
954 stars 87 forks source link

Failed to parse thread information with group chats related to the sell stuff via FB feature. #325

Closed chadcatlett closed 7 years ago

chadcatlett commented 7 years ago

When using the feature on Facebook to sell items, it uses Messenger to allow you to communicate with potential buyers. These group chats/threads currently result in the plugin raising the error 'Failed to parse thread information'.

I can send a debug l log that shows the JSON response from the FB http servers. Just let me know and I'll email it to you per wiki instructions.

jaymzh commented 7 years ago

I'm running into this. It seems to go away when that conversation goes dormant for long enough. The relevant part of the log seems to be:

(01:01:49) facebook:   00000180  6c 74 61 53 65 71 49 64  22 3a 31 32 39 34 33 31  |ltaSeqId":129431|
(01:01:49) facebook:   00000190  34 2c 22 6c 61 73 74 49  73 73 75 65 64 53 65 71  |4,"lastIssuedSeq|
(01:01:49) facebook:   000001a0  49 64 22 3a 31 32 39 34  33 31 34 7d              |Id":1294314}|
(01:01:49) facebook:   000001b0
(01:01:49) facebook: Parsing JSON: {"deltas":[{"deltaNewMessage":{"messageMetadata":{"threadKey":{"threadFbId":1568379093236203},"messageId":"mid.$gAAWSbra5uetjtFYuBFdgxDlZmnKf","offlineThreadingId":6296248029659427487,"actorFbId":3430028,"timestamp":1501142509060,"shouldBuzzDevice":1,"tags":["source:chat:web"]},"body":"sorry for the delay in letting you know, I was out of town","attachments":[],"ttl":0}}],"firstDeltaSeqId":1294314,"lastIssuedSeqId":1294314}

(01:01:49) g_log: purple_conversation_get_chat_data: assertion 'conv != NULL' failed
(01:01:49) GLib-GObject: value "-1112519639" of type 'gint' is invalid or out of range for property 'weight' of type 'gint'
(01:01:49) GLib-GObject: value "-1112519639" of type 'gint' is invalid or out of range for property 'weight' of type 'gint'
(01:01:49) dbus: Need to register an object with the dbus subsystem. (If you are not a developer, please ignore this message.)
(01:01:49) dbus: The signal "conversation-displayed" caused some dbus error. (If you are not a developer, please ignore this message.)

It gets a message, parses the packets, sucks out the JSON, parses that and then fails an assertion.

I can provide a more complete log if necessary, but there doesn't seem to be anything else relevant.

dequis commented 7 years ago

@jaymzh i don't see any error messages there. Also, if it's not a marketplace chat, it's not the same bug, open a new ticket

jaymzh commented 7 years ago

@dequis yes, it's a marketplace chat. That JSON message is me sending a message to a marketplace chat from WWW and then Pidgin immediately disconnects. 100% repeatable.

jaymzh commented 7 years ago

I managed to catch another one of this in a Marketplace chat. Here are all the lines leading up to the Connection error:

(15:30:59) http: Generated request headers:
POST /graphql HTTP/1.1
Host: graph.facebook.com
Connection: Keep-Alive
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 340
Authorization: OAuth REDACTED
User-Agent: Facebook plugin / Purple / 0.9.4 [FBAN/Orca-Android;FBAV/109.0.0.17.70;FBPN/com.facebook.orca;FBLC/en_US;FBBV/52182662]
Content-Type: application/x-www-form-urlencoded; charset=utf-8

(15:30:59) nss: SSL version 3.4 using 128-bit AES-GCM with 128-bit AEAD MAC
Server Auth: 256-bit TLS 1.3, Key Exchange: 255-bit TLS 1.3, Compression: NULL
Cipher Suite Name: TLS_AES_128_GCM_SHA256
(15:30:59) nss: subject=CN=*.facebook.com,O="Facebook, Inc.",L=Menlo Park,ST=California,C=US issuer=CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US
(15:30:59) nss: partial certificate chain
(15:30:59) certificate/x509/tls_cached: Starting verify for graph.facebook.com
(15:30:59) certificate/x509/tls_cached: Checking for cached cert...
(15:30:59) certificate/x509/tls_cached: ...Found cached cert
(15:30:59) nss/x509: Loading certificate from /home/phil/.purple/certificates/x509/tls_peers/graph.facebook.com
(15:30:59) certificate/x509/tls_cached: Peer cert matched cached
(15:30:59) nss/x509: Exporting certificate to /home/phil/.purple/certificates/x509/tls_peers/graph.facebook.com
(15:30:59) util: Writing file /home/phil/.purple/certificates/x509/tls_peers/graph.facebook.com
(15:30:59) nss: Trusting CN=*.facebook.com,O="Facebook, Inc.",L=Menlo Park,ST=California,C=US
(15:30:59) certificate: Successfully verified certificate for graph.facebook.com
(15:30:59) http: Generated request headers:
POST /graphql HTTP/1.1
Host: graph.facebook.com
Connection: Keep-Alive
Accept: */*
Accept-Encoding: gzip, deflate
Content-Length: 315
Authorization: OAuth REDACTED
User-Agent: Facebook plugin / Purple / 0.9.4 [FBAN/Orca-Android;FBAV/109.0.0.17.70;FBPN/com.facebook.orca;FBLC/en_US;FBBV/52182662]
Content-Type: application/x-www-form-urlencoded; charset=utf-8

(15:31:00) http: Got main header with code 200
(15:31:00) http: Got header: ETag: "REDACTED"
(15:31:00) http: Got header: fb-graphql-error-count: 0
(15:31:00) http: Got header: Access-Control-Expose-Headers: X-FB-Debug, X-Loader-Length
(15:31:00) http: Got header: access-control-allow-method: OPTIONS
(15:31:00) http: Got header: Expires: Sat, 01 Jan 2000 00:00:00 GMT
(15:31:00) http: Got header: Content-Type: application/json; charset=UTF-8
(15:31:00) http: Got header: facebook-api-version: v1.0
(15:31:00) http: Got header: x-fb-trace-id: Alf5qHCFxOQ
(15:31:00) http: Got header: x-fb-rev: 3198307
(15:31:00) http: Got header: Access-Control-Allow-Credentials: true
(15:31:00) http: Got header: Cache-Control: private, no-cache, no-store, must-revalidate
(15:31:00) http: Got header: Pragma: no-cache
(15:31:00) http: Got header: Vary: Origin
(15:31:00) http: Got header: Access-Control-Allow-Origin: https://graph.facebook.com
(15:31:00) http: Got header: Set-Cookie: cm_j=eu; expires=Wed, 09-Aug-2017 22:30:59 GMT; Max-Age=604799; path=/; domain=.facebook.com; secure; httponly
(15:31:00) http: Got header: Vary: Accept-Encoding
(15:31:00) http: Got header: Content-Encoding: gzip
(15:31:00) http: Got header: X-FB-Debug: REDACTED
(15:31:00) http: Got header: Date: Wed, 02 Aug 2017 22:31:00 GMT
(15:31:00) http: Got header: Connection: keep-alive
(15:31:00) http: Got header: Content-Length: 766
(15:31:00) http: Got headers end
(15:31:00) http: Got response headers: ETag: "REDACTED"
fb-graphql-error-count: 0
Access-Control-Expose-Headers: X-FB-Debug, X-Loader-Length
access-control-allow-method: OPTIONS
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Content-Type: application/json; charset=UTF-8
facebook-api-version: v1.0
x-fb-trace-id: Alf5qHCFxOQ
x-fb-rev: 3198307
Access-Control-Allow-Credentials: true
Cache-Control: private, no-cache, no-store, must-revalidate
Pragma: no-cache
Vary: Origin
Access-Control-Allow-Origin: https://graph.facebook.com
Set-Cookie: cm_j=eu; expires=Wed, 09-Aug-2017 22:30:59 GMT; Max-Age=604799; path=/; domain=.facebook.com; secure; httponly
Vary: Accept-Encoding
Content-Encoding: gzip
X-FB-Debug: REDACTED
Date: Wed, 02 Aug 2017 22:31:00 GMT
Connection: keep-alive
Content-Length: 766
(15:31:00) http: Cookies: cm_j: eu (expires: 0)
(15:31:00) http: releasing a socket: 0x564c492c5fe0
(15:31:00) http: Request 0x564c48e18de0 performed successfully.
(15:31:00) facebook: HTTP Response (0x564c48e18de0):
(15:31:00) facebook:   Response Error: 200
(15:31:00) facebook:   Response Data: {"1399440976819980":{"all_participant_ids":null,"all_participants":{"nodes":[{"messaging_actor":{"__type__":{"name":"User"},"can_viewer_message":true,"commerce_page_type":null,"communicationRank":null,"email_addresses":[],"id":"896680028","is_blocked_by_viewer":false,"i
s_commerce":null,"is_message_blocked_by_viewer":false,"is_messenger_user":null,"is_partial":null,"name":"Dale Buchanan","profile_pic_large":null,"profile_pic_medium":null,"profile_pic_small":null,"structured_name":null}},{"messaging_actor":{"__type__":{"name":"User"},"can_viewer_message":true,"commerce_page
_type":null,"communicationRank":null,"email_addresses":[REDACTED],"id":"3430028","is_blocked_by_viewer":false,"is_commerce":null,"is_message_blocked_by_viewer":false,"is_messenger_user":null,"is_partial":null,"name":"Phil Dibowitz","profile_pic_large":null,"profile_pic_medium
":null,"profile_pic_small":null,"structured_name":null}}]},"can_viewer_reply":true,"cannot_reply_reason":null,"customization_info":null,"delivery_receipts":{"nodes":[{"__type__":{"name":"MessagingDeliveryReceipt"},"actor":{"__type__":{"name":"User"},"id":"896680028"},"timestamp_precise":"1501713028381"}]},"
ephemeral_ttl_mode":0,"folder":"INBOX","former_participant_ids":null,"former_participants":{"nodes":[]},"has_viewer_archived":false,"id":"REDACTED","image":null,"is_group_thread":true,"is_viewer_subscribed":true,"last_message":{"nodes":[{"__type__":{
"name":"UserMessage"},"message":{"text":""},"message_sender":{"email":"896680028\u0040facebook.com","messaging_actor":{"__type__":{"name":"User"},"id":"896680028","name":"Dale Buchanan"}},"snippet":"Dale: \udb80\udc00"}]},"messages":null,"mute_until":null,"name":"Phil \u00b7 2 x Cliff Em All Laser Discs","r
ead_receipts":{"nodes":[{"__type__":{"name":"MessagingReadReceipt"},"actor":{"__type__":{"name":"User"},"id":"896680028"},"timestamp_precise":"1501713028381"},{"__type__":{"name":"MessagingReadReceipt"},"actor":{"__type__":{"name":"User"},"id":"3430028"},"timestamp_precise":"1501713047526"}]},"thread_key":{
"other_user_id":null,"thread_fbid":"1399440976819980"},"unread_count":1,"updated_time_precise":"1501713047527"}}
(15:31:00) facebook: Parsing JSON: {"1399440976819980":{"all_participant_ids":null,"all_participants":{"nodes":[{"messaging_actor":{"__type__":{"name":"User"},"can_viewer_message":true,"commerce_page_type":null,"communicationRank":null,"email_addresses":[],"id":"896680028","is_blocked_by_viewer":false,"is_c
ommerce":null,"is_message_blocked_by_viewer":false,"is_messenger_user":null,"is_partial":null,"name":"Dale Buchanan","profile_pic_large":null,"profile_pic_medium":null,"profile_pic_small":null,"structured_name":null}},{"messaging_actor":{"__type__":{"name":"User"},"can_viewer_message":true,"commerce_page_ty
pe":null,"communicationRank":null,"email_addresses":[REDACTED],"id":"3430028","is_blocked_by_viewer":false,"is_commerce":null,"is_message_blocked_by_viewer":false,"is_messenger_user":null,"is_partial":null,"name":"Phil Dibowitz","profile_pic_large":null,"profile_pic_medium":n
ull,"profile_pic_small":null,"structured_name":null}}]},"can_viewer_reply":true,"cannot_reply_reason":null,"customization_info":null,"delivery_receipts":{"nodes":[{"__type__":{"name":"MessagingDeliveryReceipt"},"actor":{"__type__":{"name":"User"},"id":"896680028"},"timestamp_precise":"1501713028381"}]},"eph
emeral_ttl_mode":0,"folder":"INBOX","former_participant_ids":null,"former_participants":{"nodes":[]},"has_viewer_archived":false,"id":"REDACTED","image":null,"is_group_thread":true,"is_viewer_subscribed":true,"last_message":{"nodes":[{"__type__":{"na
me":"UserMessage"},"message":{"text":""},"message_sender":{"email":"896680028\u0040facebook.com","messaging_actor":{"__type__":{"name":"User"},"id":"896680028","name":"Dale Buchanan"}},"snippet":"Dale: \udb80\udc00"}]},"messages":null,"mute_until":null,"name":"Phil \u00b7 2 x Cliff Em All Laser Discs","read
_receipts":{"nodes":[{"__type__":{"name":"MessagingReadReceipt"},"actor":{"__type__":{"name":"User"},"id":"896680028"},"timestamp_precise":"1501713028381"},{"__type__":{"name":"MessagingReadReceipt"},"actor":{"__type__":{"name":"User"},"id":"3430028"},"timestamp_precise":"1501713047526"}]},"thread_key":{"ot
her_user_id":null,"thread_fbid":"1399440976819980"},"unread_count":1,"updated_time_precise":"1501713047527"}}

(15:31:00) connection: Connection error on 0x564c49538500 (reason: 0 description: Failed to parse thread information)
(15:31:00) http: destroying socket: 0x564c492c5fe0
(15:31:00) account: Disconnecting account jaymzh (0x564c47081760)

I've replaced auth tokens and emails with REDACTED

jaymzh commented 7 years ago

@dequis is that log more useful?

dequis commented 7 years ago

It does confirm that it's the same issue.

dequis commented 7 years ago

This is fixed with 0.9.5

https://github.com/dequis/purple-facebook/releases/tag/v0.9.5-9ff9acf9fa14