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

Listen to gets stuck in infinite loop #500

Closed
SpringsTea opened this issue Sep 29, 2020 · 3 comments
Closed

Listen to gets stuck in infinite loop #500

SpringsTea opened this issue Sep 29, 2020 · 3 comments

Comments

@SpringsTea
Copy link

SpringsTea commented Sep 29, 2020

I have a simple listener that looks for images in a network drive. This is on Windows btw.

listener = Listen.to(PATH, latency: 3, wait_for_delay: 3, only: /\.jpg$/i) do |modified, added, removed|
      Log.info("Collecting files...#{added.count}") 
      Log.info(added, false)
      if added.count > 0
        #call a function
      else
        Log.info('No new files found');
      end    
    end
listener.start
sleep

So the path it's listening to, will have folders with a couple hundred jpgs added to it. Sometimes, maybe about one in 10 times, the listener will just get stuck, with the last few files being registered as added over and over again forever. An example log:

I, [2020-09-29T13:08:30.277409 #16056]  INFO -- : ["//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110459.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110467.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110471.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110499.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110506.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110536.JPG"]
I, [2020-09-29T13:08:33.345747 #16056]  INFO -- : Collecting files...6
I, [2020-09-29T13:08:33.346199 #16056]  INFO -- : ["//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110459.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110467.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110471.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110499.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110506.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110536.JPG"]
I, [2020-09-29T13:08:39.256686 #16056]  INFO -- : Collecting files...6
I, [2020-09-29T13:08:39.257130 #16056]  INFO -- : ["//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110459.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110467.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110471.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110499.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110506.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110536.JPG"]
I, [2020-09-29T13:08:42.410730 #16056]  INFO -- : Collecting files...6
I, [2020-09-29T13:08:42.411234 #16056]  INFO -- : ["//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110459.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110467.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110471.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110499.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110506.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110536.JPG"]
I, [2020-09-29T13:08:48.277820 #16056]  INFO -- : Collecting files...6
I, [2020-09-29T13:08:48.278243 #16056]  INFO -- : ["//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110459.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110467.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110471.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110499.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110506.JPG", "//edge-image10/GreenScreen/ftp/testfolder/CFT-E211-0/MH-PT-CFT-E2110536.JPG"]

Just the same last couple files over and over. Only happens sometimes, and only on the network drive, and not my local hard drive, which make me think it has something to do with the type of file system the network uses. Any help is appreciated.

@ColinDKelley
Copy link
Collaborator

@SpringsTea Can you try v3.3.0.pre.2 and see if the problem still persists? If so, could you fork the repo and add a bunch of debug logging right in that area to try to figure out why it is spinning? I had to do a similar thing with the linux driver in order to track down bug #481 (although in that case it wasn't spinning, but rather hanging where it wouldn't track changes).

@SpringsTea
Copy link
Author

I tried it with 3.1.5 to confirm the issue was still happening, got it to happen on the first try. Then I switched to v3.3.0.pre.2 and tried it three times, with no issues. I'll try it out in production for a while.

@ColinDKelley
Copy link
Collaborator

@SpringsTea Unless you've seen the problem recur, I'd like to close this ticket out and add it as fixed in the v3.3.0 release notes. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@ColinDKelley @SpringsTea and others