hoehermann / purple-gowhatsapp

Pidgin/libpurple plug-in for WhatsApp Web.
GNU General Public License v3.0
287 stars 35 forks source link

Race condition in profile picture downloader #99

Closed EionRobb closed 2 years ago

EionRobb commented 2 years ago

Just grabbed the latest libgowhatsapp_0.0.0r56_20220111203410_win32.dll build from https://buildbot.hehoe.de/purple-whatsmeow/builds/ and even though I already had an account set up with the whatsmeow build, it asked me to scan again. As soon as I do, it crashes Pidgin (well, by crashes, it seems to abort and then quit pidgin nicely)

(10:25:41) whatsmeow: [Handler] Deleting obsolete device 6421478252.0:4@s.whatsapp.net from database...
(10:25:41) whatsmeow: [Client/QRChannel] Closing channel with status {Event:success Error:<nil> Code: Timeout:0s}
(10:25:41) whatsmeow: [Handler] Login event:%!(EXTRA string=success)
(10:25:41) whatsmeow: [Client/QRChannel] Got signal to stop QR emitter
(10:25:41) account: Disconnecting account eionrobb (0ACCA8E8)
(10:25:41) connection: Disconnecting connection 0B76AF30
[New Thread 7564.0x4f24]
[New Thread 7564.0x2f80]
[New Thread 7564.0x31f0]
[New Thread 7564.0x4410]
[New Thread 7564.0xda0]
panic: runtime error: index out of range [0] with length 0

goroutine 202 [running]:
main.parseJID({0x0, 0x0})
        D:/purple-whatsmeow/source/src/go/send_message.go:12 +0x2d7
main.(*Handler).profile_picture_downloader(0x20510000)
        D:/purple-whatsmeow/source/src/go/profile.go:34 +0x1d1
created by main.(*Handler).eventHandler
        D:/purple-whatsmeow/source/src/go/handler.go:46 +0xb11
[Thread 7564.0x3798 exited with code 2]
hoehermann commented 2 years ago

That build is literally 10 minutes old. :smile: I worked on the buildbot without checking the results for win32. Investigating now…

EionRobb commented 2 years ago

😄 you mentioned in https://github.com/hoehermann/purple-gowhatsapp/issues/6#issuecomment-1013481010 that you needed testers for it, so figured I'd try it out to see if it fixed my "buddies dont show online" issue

EionRobb commented 2 years ago

Just to make sure it wasn't something to do with existing accounts, I removed ~/.purple/whatsmeow.db and tried reconnecting but still the same panic

EionRobb commented 2 years ago

Doesn't panic any more. Doesn't connect though :) I'll open a new issue

EionRobb commented 2 years ago

oic, after the scan, it disables the account, rather than just setting it offline and auto-reconnecting

hoehermann commented 2 years ago

you mentioned that you needed testers for it

And I am very grateful for your input. :)

after the scan, it disables the account

Good point. I want to revise that behaviour.

Doesn't panic any more. Doesn't connect though

Also I just noticed the plug-in can hang upon close().

if it fixed my "buddies dont show online" issue

Did it?

rojmiller commented 2 years ago

Should you be using the Win32 build. I just downloaded and installed the first build in the list (libgowhatsapp.dll) and it installed and seems to work ok (after telling me to change my username format)

hoehermann commented 2 years ago

Thank you very much for your feedback, both of you!

@rojmiller

after telling me to change my username format

That never happened to me before. What did you enter for a username? I might want to add that to the readme.

Also I just noticed the plug-in can hang upon close().

This should now be resolved.

@EionRobb

after the scan, it disables the account

This also does not happen any longer. :)

rojmiller commented 2 years ago

I previously just had my phone number (old build?). It asked for a change to the format 1xxxxxxxxxx.0:5@s.whatsapp.net, where xxxxxxxxxx is my phone number.

hoehermann commented 2 years ago

Yes, that restriction was removed. The username is now yours to choose, only used for Pidgin's internal identification. To the outside, your phone number is shown.