www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - User feedback - recurrent runtime bug

reply simen <simen nowhere.com> writes:
I tried D some years ago and liked it's ideas but thought it too soon to 
jump in then.

Call this try once.

Then I came back about a year ago to try D version 2 and again found it 
also too early to jump in, but, admittedly, still liking the D concept. 
  IIRC the reason I dropped out the second time was then to do with 
cyclic dependency problems that emerged when I tried converting a Java 
project to D just for fun.

Call this try twice.

A year later I try D version 2 to see if it has improved.  Porting some 
rather simple Java code to D and compiling it without error, I am 
initially impressed that the SLOC metric is much smaller than the 
original Java code.  So far, so good until running the simple app, the 
same runtime error message surfaces as per my second attempt a year ago:

object.Exception: Cyclic dependency in module test

Call this try twice again and now thrice shy.

 From what can glean this does not need a new bug report being a known 
and still uncorrected problem.

- simen
Nov 04 2010
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 11/4/10 8:32 AM, simen wrote:
 I tried D some years ago and liked it's ideas but thought it too soon to
 jump in then.

 Call this try once.

 Then I came back about a year ago to try D version 2 and again found it
 also too early to jump in, but, admittedly, still liking the D concept.
 IIRC the reason I dropped out the second time was then to do with cyclic
 dependency problems that emerged when I tried converting a Java project
 to D just for fun.

 Call this try twice.

 A year later I try D version 2 to see if it has improved. Porting some
 rather simple Java code to D and compiling it without error, I am
 initially impressed that the SLOC metric is much smaller than the
 original Java code. So far, so good until running the simple app, the
 same runtime error message surfaces as per my second attempt a year ago:

 object.Exception: Cyclic dependency in module test

 Call this try twice again and now thrice shy.

  From what can glean this does not need a new bug report being a known
 and still uncorrected problem.

 - simen
To make this quest successful, you may want to reduce the code to a simple test case and submit it as a bug report or post it here. As the error you're encountering is the only problem you're seeing whenever you try your code and an infrequent one for others, it's not impossible it's a usage error rather than a bug in the language or its implementation. At any rate, just describing how you feel makes it difficult to pinpoint and solve whatever matter you've been hitting. Thanks for sharing, Andrei
Nov 04 2010
parent reply Jesse Phillips <jessekphillips+D gmail.com> writes:
Andrei Alexandrescu Wrote:

 To make this quest successful, you may want to reduce the code to a 
 simple test case and submit it as a bug report or post it here. As the 
 error you're encountering is the only problem you're seeing whenever you 
 try your code and an infrequent one for others, it's not impossible it's 
 a usage error rather than a bug in the language or its implementation. 
 At any rate, just describing how you feel makes it difficult to pinpoint 
 and solve whatever matter you've been hitting.
 
 
 Thanks for sharing,
 
 Andrei
Or you could look at: http://d.puremagic.com/issues/show_bug.cgi?id=2457 Then there are other cyclic/import bugs: http://d.puremagic.com/issues/show_bug.cgi?id=5053 http://d.puremagic.com/issues/show_bug.cgi?id=4384 http://d.puremagic.com/issues/show_bug.cgi?id=3979 Which of course is a good way to find out if a particular bug has been fixed or not. I don't know if the message will just be moved into compile time (I've it it myself and haven't minded it too much, other than it happening at run-time).
Nov 04 2010
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 04 Nov 2010 10:31:47 -0400, Jesse Phillips  
<jessekphillips+D gmail.com> wrote:

 Andrei Alexandrescu Wrote:

 To make this quest successful, you may want to reduce the code to a
 simple test case and submit it as a bug report or post it here. As the
 error you're encountering is the only problem you're seeing whenever you
 try your code and an infrequent one for others, it's not impossible it's
 a usage error rather than a bug in the language or its implementation.
 At any rate, just describing how you feel makes it difficult to pinpoint
 and solve whatever matter you've been hitting.


 Thanks for sharing,

 Andrei
Or you could look at: http://d.puremagic.com/issues/show_bug.cgi?id=2457 Then there are other cyclic/import bugs: http://d.puremagic.com/issues/show_bug.cgi?id=5053 http://d.puremagic.com/issues/show_bug.cgi?id=4384 http://d.puremagic.com/issues/show_bug.cgi?id=3979 Which of course is a good way to find out if a particular bug has been fixed or not. I don't know if the message will just be moved into compile time (I've it it myself and haven't minded it too much, other than it happening at run-time).
Compile time is not possible. You cannot construct the import graph until link time, and the linker does not support performing any kind of analysis. -Steve
Nov 04 2010
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from Steven Schveighoffer (schveiguy yahoo.com)'s article
 On Thu, 04 Nov 2010 10:31:47 -0400, Jesse Phillips
 <jessekphillips+D gmail.com> wrote:
 Andrei Alexandrescu Wrote:

 To make this quest successful, you may want to reduce the code to a
 simple test case and submit it as a bug report or post it here. As the
 error you're encountering is the only problem you're seeing whenever you
 try your code and an infrequent one for others, it's not impossible it's
 a usage error rather than a bug in the language or its implementation.
 At any rate, just describing how you feel makes it difficult to pinpoint
 and solve whatever matter you've been hitting.


 Thanks for sharing,

 Andrei
Or you could look at: http://d.puremagic.com/issues/show_bug.cgi?id=2457 Then there are other cyclic/import bugs: http://d.puremagic.com/issues/show_bug.cgi?id=5053 http://d.puremagic.com/issues/show_bug.cgi?id=4384 http://d.puremagic.com/issues/show_bug.cgi?id=3979 Which of course is a good way to find out if a particular bug has been fixed or not. I don't know if the message will just be moved into compile time (I've it it myself and haven't minded it too much, other than it happening at run-time).
Compile time is not possible. You cannot construct the import graph until link time, and the linker does not support performing any kind of analysis. -Steve
Agreed, and what makes the plot thicker is that it also depends on the *order* that you send files to the linker too. Bug report from Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583837 Regards Iain
Nov 04 2010
parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 04 Nov 2010 12:41:16 -0400, Iain Buclaw <ibuclaw ubuntu.com> wrote:

 == Quote from Steven Schveighoffer (schveiguy yahoo.com)'s article
 Compile time is not possible.  You cannot construct the import graph  
 until
 link time, and the linker does not support performing any kind of  
 analysis.
 -Steve
Agreed, and what makes the plot thicker is that it also depends on the *order* that you send files to the linker too. Bug report from Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=583837
That actually shouldn't matter. I believe what you are seeing is a manifestation of bug 4384. The cycle detection algorithm is broken, it doesn't detect some cycles, and I would not be surprised if link order affected whether a certain cycle was detected. -Steve
Nov 04 2010
prev sibling next sibling parent Michel Fortin <michel.fortin michelf.com> writes:
On 2010-11-04 09:32:35 -0400, simen <simen nowhere.com> said:

 I tried D some years ago and liked it's ideas but thought it too soon 
 to jump in then.
 
 Call this try once.
 
 Then I came back about a year ago to try D version 2 and again found it 
 also too early to jump in, but, admittedly, still liking the D concept. 
   IIRC the reason I dropped out the second time was then to do with 
 cyclic dependency problems that emerged when I tried converting a Java 
 project to D just for fun.
 
 Call this try twice.
 
 A year later I try D version 2 to see if it has improved.  Porting some 
 rather simple Java code to D and compiling it without error, I am 
 initially impressed that the SLOC metric is much smaller than the 
 original Java code.  So far, so good until running the simple app, the 
 same runtime error message surfaces as per my second attempt a year ago:
 
 object.Exception: Cyclic dependency in module test
 
 Call this try twice again and now thrice shy.
This last one is a different problem... and is by design. D allows cyclic imports between modules. But if one of the modules involved in the cyclic dependency contains a "static this()" the runtime will not be able to determine in which order the modules must be initialized and will complain with the exception you just got. The error message isn't very clear though. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Nov 04 2010
prev sibling parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 04 Nov 2010 09:32:35 -0400, simen <simen nowhere.com> wrote:

 I tried D some years ago and liked it's ideas but thought it too soon to  
 jump in then.

 Call this try once.

 Then I came back about a year ago to try D version 2 and again found it  
 also too early to jump in, but, admittedly, still liking the D concept.  
   IIRC the reason I dropped out the second time was then to do with  
 cyclic dependency problems that emerged when I tried converting a Java  
 project to D just for fun.

 Call this try twice.

 A year later I try D version 2 to see if it has improved.  Porting some  
 rather simple Java code to D and compiling it without error, I am  
 initially impressed that the SLOC metric is much smaller than the  
 original Java code.  So far, so good until running the simple app, the  
 same runtime error message surfaces as per my second attempt a year ago:

 object.Exception: Cyclic dependency in module test

 Call this try twice again and now thrice shy.

  From what can glean this does not need a new bug report being a known  
 and still uncorrected problem.
It is likely the cyclic dependency problem will not be solved. The granularity is too coarse -- if two modules contain static constructors, and they depend on eachother, then there is a cycle. It doesn't matter if the static constructors don't access data from other modules. There are two options I can think of for solutions. First is to add syntax to indicate the lack of dependency. This is unlikely to happen, but probably the only true solution. If someone can come up with some reasonable syntax, it might be considered. Second is to have the compiler create a true dependency tree based on what variables are accessed. This would most likely involve creating a custom object format (and linker), and is akin to full escape analysis. This is *very* unlikely to happen unless someone wants to do all the work on their own. For now, there are probably workarounds you can use to alleviate the problem. I can't really say how you can apply them without some example of your code. There is also the issue of a cryptic error message. "Cyclic dependency in module test" gives you almost no information. This is an issue I hope to solve, when I have some spare time. I have already tried to solve it but ran into some severe bugs, but I can work around those bugs for now. -Steve
Nov 04 2010
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 04 Nov 2010 10:20:28 -0400, Steven Schveighoffer  
<schveiguy yahoo.com> wrote:

 There is also the issue of a cryptic error message.  "Cyclic dependency  
 in module test" gives you almost no information.  This is an issue I  
 hope to solve, when I have some spare time.  I have already tried to  
 solve it but ran into some severe bugs, but I can work around those bugs  
 for now.
I fixed the cyclic dependency algorithm, and added a verbose printout when a cycle is detected (showing you the entire cycle). Hopefully this at least helps diagnosing this problem. http://www.dsource.org/projects/druntime/changeset/414 -Steve
Nov 08 2010
parent reply Iain Buclaw <ibuclaw ubuntu.com> writes:
== Quote from Steven Schveighoffer (schveiguy yahoo.com)'s article
 On Thu, 04 Nov 2010 10:20:28 -0400, Steven Schveighoffer
 <schveiguy yahoo.com> wrote:
 There is also the issue of a cryptic error message.  "Cyclic dependency
 in module test" gives you almost no information.  This is an issue I
 hope to solve, when I have some spare time.  I have already tried to
 solve it but ran into some severe bugs, but I can work around those bugs
 for now.
I fixed the cyclic dependency algorithm, and added a verbose printout when a cycle is detected (showing you the entire cycle). Hopefully this at least helps diagnosing this problem. http://www.dsource.org/projects/druntime/changeset/414 -Steve
Will this be applied to D1 too? Regards Iain
Nov 08 2010
parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Mon, 08 Nov 2010 10:06:11 -0500, Iain Buclaw <ibuclaw ubuntu.com> wrote:

 == Quote from Steven Schveighoffer (schveiguy yahoo.com)'s article
 On Thu, 04 Nov 2010 10:20:28 -0400, Steven Schveighoffer
 <schveiguy yahoo.com> wrote:
 There is also the issue of a cryptic error message.  "Cyclic  
dependency
 in module test" gives you almost no information.  This is an issue I
 hope to solve, when I have some spare time.  I have already tried to
 solve it but ran into some severe bugs, but I can work around those  
bugs
 for now.
I fixed the cyclic dependency algorithm, and added a verbose printout when a cycle is detected (showing you the entire cycle). Hopefully this at least helps diagnosing this problem. http://www.dsource.org/projects/druntime/changeset/414 -Steve
Will this be applied to D1 too?
It should be (since it's a bug fix for D1 too), but I'm not involved with D1 Phobos at all. I'm pretty sure Tango will apply it, but I'm not involved there either. -Steve
Nov 08 2010