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

Event sent twice #45

Closed
SpartanJ opened this issue Jul 26, 2013 · 10 comments
Closed

Event sent twice #45

SpartanJ opened this issue Jul 26, 2013 · 10 comments
Labels
bug Something isn't working major

Comments

@SpartanJ
Copy link
Owner

Original report by Ugo Robain (Bitbucket: wizzhard, GitHub: wizzhard).


It seems that events are sent twice sometime. This is valid for all events (add, delete, moved, modified)

I use windows 7 x64 with a not generic file watcher.

@SpartanJ
Copy link
Owner Author

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


Hi Ugo,
I need a better description on how to reproduce the bug. This never happened to me.
It's normal to receive the event Add followed by the event Modified. But, you should not be getting a repeated event. May be you have a symlink folder inside the folder tree watched?

@SpartanJ
Copy link
Owner Author

Original comment by Ugo Robain (Bitbucket: wizzhard, GitHub: wizzhard).


I don't know why but if I inherit an object from FileWatcher and QObject is causes the events to be duplicated sometimes, in fact events come from two differents threads. I have separated FileWatcher from my QObject and it works now.
I assume it is caused by QObject but it could come from another reason, this is one of the most probable to me.

Thx, I think we can close the bug.

@SpartanJ
Copy link
Owner Author

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


Great. Let me know if you find any other problem!

@SpartanJ
Copy link
Owner Author

SpartanJ commented Sep 1, 2014

Original comment by Yash pal (Bitbucket: codeyash, GitHub: codeyash).


Facing similar problem. Even removing QObject didn't solve problem.

Also we should support using QObject if we are using Qt. Without QObject most of things we can't use. I've already created a bug with more info on this.

We should reopen this and attach to new reported one.

@SpartanJ
Copy link
Owner Author

SpartanJ commented Sep 1, 2014

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


If this a Qt issue i will not give any kind of support because it's out of the scope of the project. If the bug comes from something in the library, i'm glad to see what's failing, but first i need a simple proof that this is an issue in the library ( code sample, and how to replicate the problem ).

@SpartanJ
Copy link
Owner Author

Original comment by Yash pal (Bitbucket: codeyash, GitHub: codeyash).


Hi Martin,

Facing again but only in MAC this time.

http://pastebin.com/xpjLNZmx - CPP File

http://pastebin.com/GhuanL9D - H File

Contains both classes Watcher and listener. I've disabled all Qt part but result still same.

Yosemite MAC OS
Qt: 5.3.2 (May not be useful for you :) )

OutPut:

DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php" ) has event Modified
"/Volumes/Work/Projects/www/market/public/index.php" : FILETYPE has event Modified
DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php" ) has event Modified
"/Volumes/Work/Projects/www/market/public/index.php" : FILETYPE has event Modified
DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php.sb-6dff1e29-JKuUXq" ) has event Delete
Refresh dir "/Volumes/Work/Projects/www/market/public"
DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php" ) has event Added
Refresh dir "/Volumes/Work/Projects/www/market/public"
IGNORing ADD
DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php" ) has event Modified

DIR ( "/Volumes/Work/Projects/www/market/" ) FILE ( "public" ) has event Modified
DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php.sb-6dff1e29-JKuUXq" ) has event Delete
Refresh dir "/Volumes/Work/Projects/www/market/public"
DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php" ) has event Added
Refresh dir "/Volumes/Work/Projects/www/market/public"
IGNORing ADD
DIR ( "/Volumes/Work/Projects/www/market/public/" ) FILE ( "index.php" ) has event Modified
"/Volumes/Work/Projects/www/market/public/index.php" : FILETYPE has event Modified

Please note: FILETYPE containing line is not duplicate. Its handled. (not good as of now)

Can you see what's the issue or anything I'm doing wrong.

Thanks,
Yash

@SpartanJ
Copy link
Owner Author

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


Hi Yash!

It's not rare to receive two modified events in row, that depends on how the files are modified by the software who's modifying the file.
You can try to disable some flags considered as Modified in FileWatcherFSEvents.hpp, you can change:

#!c++

	efswFSEventsModified							= efswFSEventStreamEventFlagItemFinderInfoMod	|
													  efswFSEventStreamEventFlagItemModified		|
													  efswFSEventStreamEventFlagItemInodeMetaMod	|
													  efswFSEventStreamEventFlagItemChangeOwner		|
													  efswFSEventStreamEventFlagItemXattrMod

for something that only takes the Modified flag as Modified ( this wouldn't be correct, but, you can try ):

#!c++

	efswFSEventsModified							= efswFSEventStreamEventFlagItemModified

The way you get this notifications is handled mostly by the OS, the only thing i can change is that flags that i mentioned.

For me it looks OK your log, but i don't know what's going on in the background ( how the files are being modified ).

Regards!

@SpartanJ
Copy link
Owner Author

Original comment by Yash pal (Bitbucket: codeyash, GitHub: codeyash).


ok I will try and let you know. Thanks for quick comment.

-Yash

@SpartanJ
Copy link
Owner Author

Original comment by Yash pal (Bitbucket: codeyash, GitHub: codeyash).


Doesn't help. Same problem. If I found anything relevant I'll post here.

@SpartanJ
Copy link
Owner Author

Original comment by Martín Lucas Golini (Bitbucket: SpartanJ, GitHub: SpartanJ).


Ok, no problem! It doesn't look as a bug at all, it seems that it's just a file being modified two times in a row.

@SpartanJ SpartanJ added major bug Something isn't working labels Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant