FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Ares updates
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9
 
Post new topic   Reply to topic     Forum Index -> Ares
View previous topic :: View next topic  
Author Message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Sat Mar 11, 2006 4:30 am    Post subject: Reply with quote

sean wrote:
And one more small fix for an access violation I suspect would have occurred. New zipfile, etc.

I think I can tentatively say you've nailed it ... ran all day with nary a GPF or a deadlock. Ares appears to be more stable than Phobos in this department ~ let's hope it doesn't die overnight!

Smile
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Sat Mar 11, 2006 12:21 pm    Post subject: Reply with quote

Ahhh ... that's much better. Nothing died last night, so there's a fair likelihood all is well. Nice work.

Perhaps this set of exchanges should be moved off into a seperate topic, so it doesn't clutter up your status branch? I should have thought of that in the first place ...
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Sat Mar 11, 2006 12:53 pm    Post subject: Reply with quote

No worries. It's nearing time to set this thread adrift and create a new one anyway.

And as for the deadlock issue--awesome! I was beginning to worry I'd be stuck trying to sort this out in a debugger Smile I'll have to look at Phobos and see if I can spot anything.
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Tue Mar 14, 2006 10:23 pm    Post subject: Reply with quote

I gave the Phobos code a look and found the remote possibility of a resource leak, but no sign of a potential deadlock yet. Safe or not, the only critical section entered by the Phobos GC run is the one protecting the GC itself. There's half of a cycle in Thread.start, as attempting to create too many threads calls error, which in turn allocates memory for an exception object (while still holding a lock on the thread list), but the GC thread never attempts to obtain the thread list lock. I don't suppose you know where these threads are deadlocking?

By the way, here's the leak situation :

- Thread A attempts to allocate memory, begins a collection, enters Thread.pauseAll, obtains a reference to thread B while iterating through the thread list, and stalls.

- Thread B starts unwinding, removes itself from the global thread list (at the end of threadstart), then stalls.

- Thread A wakes up and suspends thread B, which it still has a reference to, pauses all other threads, collects, and resumes all threads in the list, which *doesn't* include thread B. So thread B will remain suspended forever, but not in the thread list.

I'd say this has a pretty slim chance of occurring, but could possibly be an issue if your app creates tons of threads that only exist for a very short time. But it still shouldn't cause a deadlock Confused
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Tue Mar 21, 2006 6:20 pm    Post subject: Reply with quote

Version 0.17 is online with these changes:

* Merged in DMD 150 changes.
* Added first cut of std.traits.
* Renamed std.string to std.array.
* Switched to Knuth find ops in std.array -- the old code still exists in version(none) blocks.
* Made speculative fix for suspend op in std.thread.
* Changed documentation in std.memory to more accurately reflect intended behavior.
* Added support for sys/epoll to sys.linux.

This release is mostly intended to stay in synch with DMD releases. It adds a few new features (in std.array and std.traits) and otherwise just tightens the screws a bit.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Tue Mar 21, 2006 9:05 pm    Post subject: Reply with quote

Cool!

Just a thought about suspend() ... isn't that an RSVP invitation for deadlock? The equivalent op was deprecated very early in the life of Java for this reason. I'm confused as to why this would be provided ...
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Mar 22, 2006 10:31 am    Post subject: Reply with quote

I originally thought it could be useful for in-process debugging, but now I'm not so sure. Suspending a thread while it's allocating memory effectively blocks the suspending thread from allocating memory itself, which greatly reduces the utility of this method. suspend is still there mostly because suspendAll is available by necessity, and it seems silly to offer one but not the other. But it may be a better idea to make all those methods private and simply offer the standalone C functions for use by the GC.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Wed Mar 22, 2006 12:51 pm    Post subject: Reply with quote

Changing the exposure sounds like a good idea ... as you know, it's not just memory allocation that's a potential issue here ~ it's pretty much anything that uses the synchronized keyword.
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Mon Apr 03, 2006 10:36 pm    Post subject: Reply with quote

Version 0.18 is online with these changes:

* Merged in DMD 151 changes.
* Added std.c.posix.fcntl.
* Added std.c.posix.sys.stat.
* std.c.posix.pthread - Updated some disabled code to be closer to usable.
* Removed Thread.suspend, Thread.suspendAll, Thread.remove, and Thread.removeAll.
* Rewrote thread_suspendAll, thread_removeAll, and thread_markAll. Only the Windows code has been tested, but is both simpler and more efficient than the old code.
* Fixed Posix implementation of Thread.sleep.
* Added 'preserve' option to ThreadGroup.joinAll (default is true).
* Added missing return statement in ThreadGroup.create.
* Added missing import statement in std.array.
* Added support function to std.math.ieee for unit testing.
* Fixed documentation in std.memory to be more accurate.
* Added lowercase 'cin', 'cout', and 'cerr' aliases to std.io.Console.

Removing Thread.suspend and Thread.remove eliminated a number of potential deadlock concerns and I decided to rewrite thread_suspendAll and thread_removeAll to take advantage of this. The new code doesn't require recursive locks and is more efficient overall than the old code. Single threaded applications now uses no locks at all during an allocation or collection, and multi threaded code acquires a lock on suspendAll and removeAll, but not on markAll (as everything is stopped at that point). There's still a bit of room for improvement in how threads are suspended under Posix, but otherwise I'm quite happy with the new code. I feel pretty confident about the Windows code, but if there are any problems on either Windows or Linux, please let me know. I think this is the first Ares release that builds and links out of the box on Linux, so enjoy it Smile
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Wed Apr 12, 2006 4:32 pm    Post subject: Reply with quote

Version 0.19 is online with these changes:

* Merged in DMD 154 changes.
* Added std.c.posix.dirent.
* Removed gc_setFinalizer.
* Removed 'nz' param from gc_calloc, as an object count doesn't make much sense within the context of a language where objects are not value types. Now, gc_calloc is functionally identical to malloc except the memory is zero-initialized before it is returned.
* Added a new parameter, df (do finalize), to gc_malloc, gc_calloc, and gc_realloc. This parameter defaults to false and is intended to replace gc_setFinalizer for indicating that a memory block should be finalized. While this limits flexibility by binding finalization indication to allocation, it reduces the chance for user error and also makes for more efficient code as both allocation and setting the doFinalize flag can be accomplished with a single mutex lock.
* Added a new extern (C) function requirement: cr_finalize(void* p,bool det=true). This function must be implemented by the compiler runtime (thus the 'cr_' prefix) and should perform any finalization required for the object referenced by 'p'. Typically, this involves calling any associated dtors, cleaning up object monitors, etc. If 'det' is true then the function is being called deterministically, false if otherwise. Thus, 'det' would be false when cr_finalize is called on an orphaned object during a garbage collection run unless the garbage collector performing a final cleanup during termination. Currently, the runtime is not required to do anything with respect to the value of 'det', but in the future it may be required to call an error routine similar to those already exposed by std.exception if the object being finalized has a dtor. This error routine would likely be overridable by the user and would default to doing nothing. The purpose of such a routine would be to allow the user to halt execution or report an error indicating object type, as non-deterministic finalization of an object with a dtor may be considered a resource leak and thus a programming error.
* Fixed a nasty bug that was corrupting the global thread list.
* Altered thread finalization code to occur on thread termination instead of on object disposal.

Note that this release fixes a problem related to multithreading that was likely the cause of random access violations and other weirdness. It also contains Linux library files, for those who care. libphobos.a is the only one you need--copy it to /usr/lib.
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Wed Apr 12, 2006 4:51 pm    Post subject: Reply with quote

Nice!
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Tue Apr 18, 2006 9:53 pm    Post subject: Reply with quote

Some new changes mave been checked in:

* Added a new callback, onFinalizeError, to be called when an exception is thrown during finalization.
* Added a new callback, onCollectResource, to be called when collecting an object with a dtor. This callback may be hooked by the user via setCollectHandler.

If anyone wants to play with them before the next release, let me know how it goes Smile
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Fri Apr 28, 2006 4:35 pm    Post subject: Reply with quote

Version 0.20 is online with these changes:

* Merged in Mango changes.
* Merged in DMD 156 changes.
* Renamed onAssert to onAssertError.
* Renamed onOutOfMemory to onOutOfMemoryError.
* Added a new callback, onFinalizeError, to be called when an exception is thrown during finalization.
* Added a new callback, onCollectResource, to be called when collecting an object with a dtor. This callback may be hooked by the user via setCollectHandler.
* Removed -I option from Linux makefiles, as it's presence is misleading. Since -I paths are appended to the existing include path, the current code is only checked if no previous matches are found. It would be easier to simply modify dmd.conf for the duration of the build or copy the source files into the proper include location. Hopefully, a future release of DMD will check additional locations other than /etc for dmd.conf so this isn't necessary.
* Added sys.windows.winmain.d and sys.windows.winmain.def. These have been packaged with Ares for a while and were left out of version control.
* Added doc/library_interaction.txt.

Plus, the Linux libraries actually work this time!
Back to top
View user's profile Send private message
sean



Joined: 24 Jun 2004
Posts: 609
Location: Bay Area, CA

PostPosted: Mon Jun 05, 2006 5:42 pm    Post subject: Reply with quote

Version 0.21 is online with these changes:

* Merged in DMD 160 changes.
* Added std.c.posix.ucontext.
* Finished std.c.posix.signal.
* Fixed a corner case in the Posix suspendHandler. Additional work is likely required to allow interrupted calls to restart after suspend completes.

This release is mostly to allow compatibility with DMD 160, which adds an optional message to asserts. This was done using a new function in std.exception: onAssertErrorMsg.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Ares All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9
Page 9 of 9

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group