OpenBazaar-Client icon indicating copy to clipboard operation
OpenBazaar-Client copied to clipboard

Create listing, Photo not always reloading from filesystem

Open sgornick opened this issue 8 years ago • 13 comments

When creating a listing, the Client is intermittently not re-reading the photo (PNG image, in this instance) file from the filesystem.

Operating System (OS and version): Ubuntu Linux 14.04 OpenBazaar version: 1.1.5 Hardware: Asus Laptop S400 dual core, (with encrypted filesystem) Reproducible: Almost Always

Steps to reproduce:

  1. Create files whitebox.png, blackbox.png.
  2. $ cp whitebox.png box.png
  3. $ eog & This launches the imageviewer tool. Open box.png (so we can prove that the filesystem has updated the file).
  4. In OB Client, Create a Listing.
  5. From shell, $ cp whitebox.png box.png
  6. In OB Client, click "Select photos" button and add box.png
  7. From shell, $ cp blackbox.png box.png
  8. Wait for imageviewer to automatically update, reflecting that the file contents changed.
  9. In OB Client, click "Select photos" button and add box.png

Observed Behavior: Even though the imageviewer showed a black box, OB Client added another white box.

Expected Behavior: Expected that the second photo added would have been the black box.

This was somewhat intermittent. If I repeat steps 5 and 6, or 7 through 9, I get the results I'm reporting at least once. e.g., maybe 33% of the time it loads a stale image (i.e., fails to re-load the file from the filesystem), so do the full procedure 5-9 twice and it is sure to happen. Eventually on subsequent attempt to Select photo (e.g., repeat step 9), with no changes at the filesystem, the OB client will start loading the fresh image.

It doesn't appear to be a certain duration or a certain number of reload attempts before correcting itself so I'm not even going to try to speculate as to what might cause this behavior. I didn't try testing with any other image format (e.g., JPG, SVG, etc.) Additionally, I tried where I would click the X to remove the current image displayed but it would still load a stale image, so it doesn't appear to be a reference count issue occurring only when the image is still loaded.

Additional info (links, images, etc go here): I've attached whitebox.png and blackbox.png for use in reproducing this issue.

blackbox whitebox

sgornick avatar May 29 '16 00:05 sgornick

I'm not able to reproduce this one. @jjeffryes @morebrownies Can either of you?

rmisio avatar Jun 02 '16 18:06 rmisio

I can't reproduce this either. It's possible that when a file name was turned into a hash and saved locally that identical file names would pick up the old hash even though they were new images.

I think the latest image code refactor should have fixed that.

jjeffryes avatar Jun 03 '16 17:06 jjeffryes

I've pulled the latest from the OB Client repository (master) from today and tried again and the problem persists for me.

Not sure why this would behave differently on my system. I didn't use the installer but instead installed first $ sudo npm install electron-prebuilt

And then $ npm install $ npm start

Anyway, ... it's a very minor issue that resolves itself by simply repeating the same action (i.e., reload the same image another time or two and eventually it will show the right one.)

Thanks for taking a look.

sgornick avatar Jun 03 '16 22:06 sgornick

Weird. I'll reopen this and see if we can get anyone else to reproduce it.

It could be a Linux issue, we haven't tried it yet on that. @SamPatt can you see if you can replicate this?

jjeffryes avatar Jun 04 '16 00:06 jjeffryes

We haven't been able to reproduce this issue. @sgornick are you still experiencing this problem?

jjeffryes avatar Aug 10 '16 15:08 jjeffryes

I have the same problem. Used completely different pictures, changed the size to small and very small... always the same problem. German to english translated message: "we cant upload your photo". I am using win10

rbmilch avatar Sep 14 '16 23:09 rbmilch

Found out: Its the source or pathname of the file C:\Users\rbmil\OneDrive\Bilder#löschen\HiPr\IMG_0345.JPG - is not working C:\Users\rbmil\OneDrive\Bilder\IMG_0345.JPG - is working

rbmilch avatar Sep 15 '16 18:09 rbmilch

Is this a case of Windows not recognizing the file page due to the German characters in it?

We rely on the OS to handle the path to the image, if it doesn't like the path then it would show an error.

jjeffryes avatar Sep 15 '16 18:09 jjeffryes

Same problem with this path: C:\Users\rbmil\OneDrive\Bilder#loeschen\HiPr\IMG_0345.JPG but not with: C:\Users\rbmil\OneDrive\Bilder\löschen\HiPr\IMG_0345.JPG

Problem is "#" not "ö"

rbmilch avatar Sep 15 '16 19:09 rbmilch

PS: github deletes the "" before "#"

Is that a bug in github webinterface, too?

rbmilch avatar Sep 15 '16 19:09 rbmilch

Pound signs are a reserved character in Chromium. We'll look into it and see if there's a way we can get around that.

https://bugs.chromium.org/p/chromium/issues/detail?id=397838

jjeffryes avatar Sep 15 '16 19:09 jjeffryes

Is OB based on chromium? Like i.e. brave browser?

rbmilch avatar Sep 15 '16 19:09 rbmilch

The OB client uses Electron, which uses Chromium.

jjeffryes avatar Sep 15 '16 20:09 jjeffryes