Re: GC deadlocks on linux

2015-03-02 Thread ketmar via Digitalmars-d-learn
On Mon, 02 Mar 2015 08:15:12 +, Kagamin wrote: On Saturday, 28 February 2015 at 05:32:51 UTC, ketmar wrote: On Sat, 28 Feb 2015 06:09:16 +0100, Martin Nowak wrote: Meanwhile the author of daemonized came up with another idea, using exec instead of fork.

Re: GC deadlocks on linux

2015-03-02 Thread Kagamin via Digitalmars-d-learn
On Saturday, 28 February 2015 at 05:32:51 UTC, ketmar wrote: On Sat, 28 Feb 2015 06:09:16 +0100, Martin Nowak wrote: Meanwhile the author of daemonized came up with another idea, using exec instead of fork. https://github.com/NCrashed/daemonize/issues/2 ahem.

Re: GC deadlocks on linux

2015-03-02 Thread Kagamin via Digitalmars-d-learn
I mean, if it used GC after fork, like in bug 6846, that would be untidy (it's complicated because GC is always a temptation).

Re: GC deadlocks on linux

2015-02-27 Thread ketmar via Digitalmars-d-learn
On Sat, 28 Feb 2015 06:09:16 +0100, Martin Nowak wrote: Meanwhile the author of daemonized came up with another idea, using exec instead of fork. https://github.com/NCrashed/daemonize/issues/2 ahem. http://forum.dlang.org/post/mc35ap$2dvo$5...@digitalmars.com signature.asc Description: PGP

Re: GC deadlocks on linux

2015-02-27 Thread Martin Nowak via Digitalmars-d-learn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/18/2015 09:27 PM, Byron Heads wrote: I have a medium size daemon application that uses several threads, libasync, and daemonize. On windows it runs correctly with GC enabled, but on linux the GC causes a deadlock while allocating memory.

Re: GC deadlocks on linux

2015-02-20 Thread Kagamin via Digitalmars-d-learn
I think, it's better to diagnose, what problem the program encounters, than to explain, what happens in kernel and glibc. The first step is to see, where it hangs and get a stacktrace.

Re: GC deadlocks on linux

2015-02-20 Thread via Digitalmars-d-learn
On Thursday, 19 February 2015 at 22:12:03 UTC, Steven Schveighoffer wrote: I'm not sure what the issue here is, but I don't think forking is as unstable as you seem to think, or maybe I'm reading this wrong. I can agree there are many gotchas with forking. You need to very carefully configure

Re: GC deadlocks on linux

2015-02-20 Thread ketmar via Digitalmars-d-learn
On Fri, 20 Feb 2015 09:04:29 +, Ola Fosheim Grøstad wrote: If you fork early in the process' lifespan, before acquiring resources, then it is much easier... and even if `fork()` is the first line of code in `main()`, there cannot be any guarantees. there can be module constructor doing

Re: GC deadlocks on linux

2015-02-20 Thread ketmar via Digitalmars-d-learn
On Fri, 20 Feb 2015 08:03:00 +, Kagamin wrote: I think, it's better to diagnose, what problem the program encounters, than to explain, what happens in kernel and glibc. The first step is to see, where it hangs and get a stacktrace. this way of thinking is exactly why i recommend to avoid

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:27:08 UTC, Byron Heads wrote: Adding core.memory.GC.disable; to main causes the application to work correctly (and quickly till it runs out of memory :D ) GC.disable shouldn't run OOM, BTW. http://dlang.org/phobos/core_memory.html#.GC.disable

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:41:12 UTC, Dicebot wrote: Any chance you are using gdm-3.12.x? I was so mad when I have encountered this: https://issues.dlang.org/show_bug.cgi?id=4890 Indeed, maybe http://dlang.org/phobos-prerelease/core_thread.html#.thread_setGCSignals might help. We

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:27:08 UTC, Byron Heads wrote: I have a medium size daemon application that uses several threads, libasync, and daemonize. On windows it runs correctly with GC enabled, but on linux the GC causes a deadlock while allocating memory. Can you reliably

Re: GC deadlocks on linux

2015-02-20 Thread via Digitalmars-d-learn
On Friday, 20 February 2015 at 12:47:58 UTC, ketmar wrote: 3rd party library that already initialized something, or... you got the idea. ;-) Yeah, either use plain C or avoid 3rd party libraries... I guess that includes phobos ;)

Re: GC deadlocks on linux

2015-02-20 Thread MartinNowak via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:27:08 UTC, Byron Heads wrote: System: DMD 2.066.1 Can you also try the latest beta please, maybe we already fixed something. http://forum.dlang.org/post/54e49e2d.2010...@dawg.eu

Re: GC deadlocks on linux

2015-02-20 Thread ketmar via Digitalmars-d-learn
On Fri, 20 Feb 2015 14:33:29 +, Ola Fosheim Grøstad wrote: On Friday, 20 February 2015 at 12:47:58 UTC, ketmar wrote: 3rd party library that already initialized something, or... you got the idea. ;-) Yeah, either use plain C or avoid 3rd party libraries... I guess that includes phobos

Re: GC deadlocks on linux

2015-02-20 Thread Kagamin via Digitalmars-d-learn
On Friday, 20 February 2015 at 14:33:31 UTC, Ola Fosheim Grøstad wrote: Yeah, either use plain C or avoid 3rd party libraries... I guess that includes phobos ;) AFAIK, in early days of unix there were no threads, processes were single-threaded, fork was the way to concurrency and exec was

Re: GC deadlocks on linux

2015-02-20 Thread via Digitalmars-d-learn
On Friday, 20 February 2015 at 22:07:56 UTC, Kagamin wrote: AFAIK, in early days of unix there were no threads, processes were single-threaded, fork was the way to concurrency and exec was the most efficient way to run a program in memory-constrained conditions of 70s (kbytes of RAM!). Plain

Re: GC deadlocks on linux

2015-02-20 Thread MartinNowak via Digitalmars-d-learn
On Friday, 20 February 2015 at 15:17:22 UTC, Martin Nowak wrote: Might want to try using libasync without multiple threads. http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them Or you temporarily disable the GC before forking and enable it again afterwards.

Re: GC deadlocks on linux

2015-02-20 Thread Martin Nowak via Digitalmars-d-learn
On 02/18/2015 09:35 PM, Byron Heads wrote: I am in the daemonize library https://github.com/NCrashed/daemonize Might want to try using libasync without multiple threads. http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them

Re: GC deadlocks on linux

2015-02-20 Thread ketmar via Digitalmars-d-learn
On Fri, 20 Feb 2015 22:29:04 +, Ola Fosheim Grøstad wrote: This robust philosophy somehow got lost in the quest for bleeding edge. i still missing it. sure, we can write our code in this style today, but with all that libraries that can create threads without you knowing about it (heh,

Re: GC deadlocks on linux

2015-02-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 2/19/15 12:01 PM, ketmar wrote: On Thu, 19 Feb 2015 16:33:58 +, Byron Heads wrote: Now I am not sure. This code runs correctly: as i told you before, `fork()` is hard. you can experiment for monthes seeing strange bugs here and there, and seeing no bugs, and strange bugs, and...

Re: GC deadlocks on linux

2015-02-19 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 21:21:11 UTC, Byron Heads wrote: On Wednesday, 18 February 2015 at 21:05:10 UTC, Byron Heads wrote: On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote: On Wednesday, 18 February 2015 at

Re: GC deadlocks on linux

2015-02-19 Thread ketmar via Digitalmars-d-learn
On Thu, 19 Feb 2015 16:33:58 +, Byron Heads wrote: Now I am not sure. This code runs correctly: as i told you before, `fork()` is hard. you can experiment for monthes seeing strange bugs here and there, and seeing no bugs, and strange bugs, and... there are alot of things going on under

Re: GC deadlocks on linux

2015-02-19 Thread ketmar via Digitalmars-d-learn
On Thu, 19 Feb 2015 17:12:02 -0500, Steven Schveighoffer wrote: On 2/19/15 12:01 PM, ketmar wrote: On Thu, 19 Feb 2015 16:33:58 +, Byron Heads wrote: Now I am not sure. This code runs correctly: as i told you before, `fork()` is hard. you can experiment for monthes seeing strange bugs

Re: GC deadlocks on linux

2015-02-18 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 21:05:10 UTC, Byron Heads wrote: On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote: On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:27:07 +, Byron

Re: GC deadlocks on linux

2015-02-18 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 21:21:11 UTC, Byron Heads wrote: On Wednesday, 18 February 2015 at 21:05:10 UTC, Byron Heads wrote: On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote: On Wednesday, 18 February 2015 at

Re: GC deadlocks on linux

2015-02-18 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote: are you forking? ;-) I am in the daemonize library https://github.com/NCrashed/daemonize

Re: GC deadlocks on linux

2015-02-18 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:41:12 UTC, Dicebot wrote: Any chance you are using gdm-3.12.x? I was so mad when I have encountered this: https://issues.dlang.org/show_bug.cgi?id=4890 Dont think so $dpkg --get-selections | grep gdm doesn't return anything also running via ssh

Re: GC deadlocks on linux

2015-02-18 Thread ketmar via Digitalmars-d-learn
On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote: are you forking? ;-) signature.asc Description: PGP signature

Re: GC deadlocks on linux

2015-02-18 Thread Dicebot via Digitalmars-d-learn
Any chance you are using gdm-3.12.x? I was so mad when I have encountered this: https://issues.dlang.org/show_bug.cgi?id=4890

Re: GC deadlocks on linux

2015-02-18 Thread ketmar via Digitalmars-d-learn
On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote: On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote: are you forking? ;-) I am in the daemonize library https://github.com/NCrashed/daemonize can you drop that and

Re: GC deadlocks on linux

2015-02-18 Thread ketmar via Digitalmars-d-learn
On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote: On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote: are you forking? ;-) I am in the daemonize library https://github.com/NCrashed/daemonize p.s. and check if you

Re: GC deadlocks on linux

2015-02-18 Thread Byron Heads via Digitalmars-d-learn
On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:35:44 +, Byron Heads wrote: On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote: On Wed, 18 Feb 2015 20:27:07 +, Byron Heads wrote: are you forking? ;-) I am in the daemonize library

Re: GC deadlocks on linux

2015-02-18 Thread ketmar via Digitalmars-d-learn
On Wed, 18 Feb 2015 21:21:10 +, Byron Heads wrote: My guess is this is going to be related to forking, going to see if I can make a test case. it's better to avoid forking at all. it's *very* hard to do forking right, it's almost impossible to do it right even in single-threaded app, and

Re: GC deadlocks on linux

2015-02-18 Thread ketmar via Digitalmars-d-learn
On Wed, 18 Feb 2015 21:21:10 +, Byron Heads wrote: p.s. if you really-really-really need to avoid shell scripts, you can `exec` your program with STDIN, STDOUT and STDERR redirected to /dev/ null, passing some special argument to it. i.e. it shouldn't fork, just exec itself again with added