-
Notifications
You must be signed in to change notification settings - Fork 88
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
Cannot receive pictures / gifs / sounds from Facebook in Pidgin sometimes #489
Comments
I set up the connection via a proxy and it seems to fix the problem. Does this mean that there is a problem with my ip or ISP? |
I found a comment which might be related: majn/telegram-purple#55 (comment) – if received images are not visible at all in the chat window (but show up in the logs folder). The culprit seems to be the "Conversation Colors" plugin (maybe only the "Ignore incoming format" option?). |
Have it for all (?) images sent to me in FB these days. purple-facebook-0.9.6-5.fc32.x86_64 |
Nope, The plugin is disabled. |
Same here, I get maybe every 20th picture. Pidgin 2.14.1 on Windows 10. |
I'm seeing this as well. Pictures I send to others through the Facebook Messenger app appear in Pidgin, but photos others send to me show nothing in Pidgin, it's like the event was never sent. But sometimes they do arrive. It seems like it could be related to the app version the sender is using or how they send the photo (attaching a photo they just took with their camera app, vs taking the photo through the Messenger app). I tried sending one from the camera app and the Facebook app and Pidgin shows them both so really not sure. |
So this finally annoyed me enough to start looking into it. I captured logs of a working and failed image. I could find no differences between the requests, except that the failed one calls
Weirdly, if I issue this exact same request with I suspected it could be because Pidgin tries to download the attachment so fast that the remote server hasn't finished storing it yet. As a test, I had someone send me the failed image a second time and sure enough, it worked the second time. Given the speed at which you can post a video to someone after the first initial slow upload, I'm pretty sure they use hashes to avoid uploading images that have already been uploaded once already. So it would make sense that sending the pic the second time just sent another link to the same original image, which by now was available on all the servers and that's why it came through the second time. This would also explain why the photos work sometimes, if they manage to end up on the servers in time just before purple-facebook requests them. So my theory is that when purple-facebook gets a 509 error response from Facebook, it should wait for a few seconds and then try again, maybe 3-4 times until it gives up. @dequis Does this delayed-retry solution sound workable? I'm afraid I lack the experience with the project to contribute a solution but I'm hoping it sounds like something that's not too hard! |
Yeah, that's one possible solution. I'm afraid it's very unlikely I'll work on that, though. Sister issue: bitlbee/bitlbee-facebook#73 |
How much work would it be to display the link of the media file (in addition to the image)? I think this is a (simple?) improvement, that would already help a lot. It sounds simpler than implementing delayed retry. Right now, end users have no idea whatsoever that an image has been sent to them if they are using Pidgin/purple-facebook. |
+1 for the question regarding workaround with link display. There is even specific check for error 509 in fb_api_json_chk():
Trying to fix it for myself (thanks @Malvineous and @knittl for the info). Dumbest retry in case of error seems not possible because of asynchronous messaging sequence. Request information shall be stored elsewhere (?) to retry after possible error. |
bitlbee-facebook can only display URLs, it doesn't embed images, and it has the same problem. If you check the issue i linked, we don't get the URL at all before calling getAttachment, just a filename.
Previously it'd disconnect the whole account. Hard to say which failure mode is worse. |
FYI the API sequence goes like this:
The problem is in step 3, instead of responding with the URL, Facebook sometimes responds with "Attachment ID 12345 doesn't exist." So at that point all you have is the attachment ID, no URL. If a retry is not possible, I wonder whether a fake message could be returned to the user, like "Unable to retrieve attachment" or something, so that at least you know you're missing something and can go look at an alternate client. |
Technically retry should be possible. Currently playing with it, will report results here unless better solution appears. |
Sounds good. I had a quick look at the code and I see what you mean. I suppose you'd have to store all the attachment requests in some kind of array and remove them when the response comes back, unless the response is an error in which case you submit the request again and increment some limit counter. In the meantime I have added |
@Malvineous wrote:
IMHO this would already be a viable workaround (showing the error message). At least then end users are informed that something was sent/not received. At the moment, I only find out days later by chance when I use a different client – I always wonder where all those new images come from and why I didn't see/receive them. Displaying an error/warning/message would at least instruct users to go check with a different client (e.g. the official browser one) |
@Malvineous wrote:
Since I got it to work via a proxy, does this mean that if we would slow down pidgin's download speed, it would work? |
Not so much the download speed as the request and response are only a couple of hundred bytes each, but rather you have to make Pidgin wait a little longer before attempting to ask Facebook for the photo's download URL. It does this by making a HTTPS POST request to https://api.facebook.com/method/messaging.getAttachment, so you want this request delayed by a couple of seconds so that when it actually hits the Facebook server, they have had time to make the photo available. If you can configure your proxy to delay requests for that URL for a second or two (noting it's both HTTPS and POST) then I believe that would fix the problem. (EDIT: I suppose if you could slow that one URL down to a speed of 50-100 bytes/sec then it would take over one second to finish sending the request so that would probably work too. But you'd only want to slow down that one URL otherwise everything else would slow to a crawl too.) For the record my |
@Malvineous thanks for the great idea. I used clumsy in order to delay the ip for api.facebook.com by 100ms. Seems to have fixed the problem. |
Reporting intermediate results of what I have for now:
Will dig more, but not sure if successful. Can publish the changes if might make sense, however don't see the proper repository for now: current one doesn't store all the files (like libpurple/protocols/facebook/api.c); and Mercurial repo for Pidgin has these files only for 3.x branch if I'm looking at the proper place. Using Pidgin v2.14.1 (Fedora repositories). |
Would you be willing to publish a Windows dll with the changes ? I'd rather have a few crashes than an unusable program. |
Sorry, I have Linux environment only. Anyway it would be better to distribute source code changes because of security point at least. |
The maintainer doesn't seem interested in this project anymore so I guess this will never be fixed ? |
Someone's patch might get a merge, as far as I understand. |
@ohhai could you commit these changes to your own fork, so we can compile from there? :) I'm this close to dumping using FB Messenger on desktop (the "updated" web client is unusable since december) |
If you're desperate and willing to compile it yourself, my dodgy fix has been working well. No crashes or anything, Pidgin just freezes for two seconds every time someone sends a picture which is only mildly annoying. I edited
It's obviously not a proper fix but it reduces my frustration levels until someone who understands the codebase better than I is able to fix it properly. I also have only received one cut-off image since doing this whereas receiving incomplete images used to happen fairly regularly, so I guess this problem has actually been going on for some time now. I always wondered why sometimes I would receive only partial images and I guess this explains it - Pidgin is downloading the image before Facebook has finished uploading it. Seems like poor design on the FB side if they tell you where to download the image before they've actually uploaded it yet... |
Supporting the previously mentioned change for self-fix. I have items |
I've thrown in the towel and use the shitty website now. As I have no idea how to compile this stuff for Windows and most of the links and instructions on the pidgin website don't work, I've given up. So thanks for all the work and goodbye. |
Have you tried Miranda? It uses a different protocol for FB. |
Hey guys. I know it's an old thread but I recently learned how to compile the plugin for windows and I created a build with the fix suggested by @Malvineous https://github.com/ae-bogdan/libfacebook_pidgin/blob/master/libfacebook_timeout_fix_%23489.dll In case anyone still needs it. Edit: this also contains the latest commits. |
This is the debug log.
Windows 10, Pidgin 2.14.1 (but this bug happens in 2.12 as well).
Been happening for at least two months.
Any clue?
The text was updated successfully, but these errors were encountered: