Giter Club home page Giter Club logo

vdkqueue's Issues

EXC_BAD_ACCESS (SIGSEGV) crash reason

                    //        I was receiving about 3 EXC_BAD_ACCESS (SIGSEGV) crash reports a month that listed the 'path' objc_msgSend

A sequence which will generate this is:

VDKQueue deallocs
_keepWatcherThreadRunning = NO
[self removeAllPaths];

At that point all entries's are deallocated.

Meanwhile the thread is stuck in kevent
An event happens on the file
the thread reads the event, retrieves the dangling entry pointer from ev.udata
crash ensues

Multithreading is hard.

A bandaid solution would be to add

if ( !_keepWatcherThreadRunning ) break;

after the kevent, that will minimise the period where the dealloc can happen, but it will still be possible, just far less likely.

Really the events need to be retained by the thread as well and only released when the thread completes, or otherwise the entries need to be validated or looked for some other way that avoids leaving a dangling pointer.

Compiler warnings

First off - great to see UKKQueue ready for 64 bit (yeah, I'm a bit behind) and using GCD, thanks!

If you turn on the -Wextra compiler warning flag when building VDKQueue, you get a few warnings about semicolons at the end of files (e.g. VDKQueue.m:L54) and about unknown pragmas (e.g. VDKQueue.m:L30,31)

Not a big issue, but would you be able to fix these warnings, just so that things look a little nicer when I build my projects.

Happy to send a pull request if you want

Thanks!

symbol(s) not found for architecture x86_64

Hi

I trying to use VDKQueue, with XCode 4.3.3, OS X 10.7.4
I've tried use addPath method, and implement VDKQueueDelegate class with a callback method.
every time I try to run it I got a compile error :
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_VDKQueue", referenced from:
objc-class-ref in AppDelegate.o
(maybe you meant: OBJC_CLASS$_VDKQueueDelegate)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

just curious, can I use VDKQueue in 64 bit ?

Thanks,

Alfian

Can not monitor a file

I have tried the code, when I add a "path" to be monitored, it works file , but if I add a "file" to be monitored, it seems working wrong. for example, if I edit a file and save it, I can only get one "DELETE" operation for ONLY ONE time...and then no matter I try, no response.

crash calling a deallocated delegate, plus memory leak

As you are probably aware, once the watcher thread has been started, there is no way to dealloc the VDKQueue object. This is because detachThread retains the target (which is "self"), so the retainCount is 2. Unless you provide a way to stop the thread, the object can never be released! Even worse, if the object was created by its delegate, and the delegate goes away, it will try to send messages to the delegate, causing a crash.

The fix I'm using is to add a new method (stopWatching:) which sets _keepWatcherThreadRunning to NO and removes all the watched path entries, then require the client to call it before calling release.

How to detect what are changed in the folder

Hi I have a possibly silly question.

I want to monitor a folder and get notified when there is any files added, deleted. modified.

with VDKQueue, I think I could get the notification.

But how to get the file names which are newly added, deleted, modified?

BRs,
Zongyao Qu

Leaks introduced when running against ARC code

I think it's because of Foundation being built with ARC enabled. This makes it so that some objects that weren't going through an autorelease pool now do, causing the NSThread to leak those objects.

malloc_history proof :

ALLOC 0x136429270-0x1364292ff [size=144]: thread_115b04000 |-[VDKQueue
watcherThread:] | -[NSObject(NSObject) autorelease] |
_CFAutoreleasePoolAddObject | CFLog | _CFLogvEx |
_CFStringCreateWithFormatAndArgumentsAux | CFStringCreateCopy |
__CFStringCreateImmutableFunnel3 | _CFRuntimeCreateInstance |
malloc_zone_malloc
----
FREE 0x136429270-0x1364292ff [size=144]: thread_115b04000 |-[VDKQueue
watcherThread:] | -[NSObject(NSObject) autorelease] |
_CFAutoreleasePoolAddObject | CFLog | _CFLogvEx | _CFRelease |
malloc_zone_free

Question: Only seems to work for the first notification?

Hi
Im not sure if this is where im supposed to ask about this stuff?

In any case. I have my code set up like this, and it will catch the first modification of the file and it returns 3 notifications (http://pastebin.com/WC2jn9Vk), but if I modify the file again it doesn't seem to change the value of n = kevent(theFD, NULL, 0, &ev, 1, &timeout);

Any help would be greatly appreciated!

VDKQueue *kqueue = [[VDKQueue alloc] init];
kqueue.delegate = self;
[kqueue addPath:path notifyingAbout:VDKQueueNotifyDefault];

-(void) VDKQueue:(VDKQueue )queue receivedNotification:(NSString)noteName forPath:(NSString*)fpath{
//Doing Stuff
}

Licensing Issue: When being awesome isn't awesome

Would you be open to the idea of making VDKQueue available under a GPL-compatible free software license, such as the 3-Clause BSD License, which is similar to your current license?

I'm a dev on the Transmission BitTorrent client, and the current license's "Be Awesome" clause could be problematic for us if we switch to VDKQueue. Transmission is bundled on several Linux distros that want software that has no restrictions, even well-intentioned like "Be Awesome", on its use.

It should be a laughing matter but unfortunately it's not. As described at https://trac.transmissionbt.com/ticket/5131, we recently switched Transmission's JSON parser because the old one's license is considered nonfree by the FSF and Debian due to its use restrictions: "This Software shall be used for Good, not Evil."

addPath: notifyingAbout Flag Issue

I'm using VDKQueue on OS X 10.7.3 in xCode 4.2 and I get a "Use of Undeclared Identifier" error on VDKQueueNotifyDefault when I try to run the following code:

VDKQueue* kqueue = [[VDKQueue alloc] init];
[kqueue addPath:@"/path/to/directory/" notifyingAbout:VDKQueueNotifyDefault];

It's actually providing undeclared identifier errors on all the u_int flags in VDKQueue.h. When I call just the "addPath" method everything works fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.