DynamoDS / Dynamo

Open Source Graphical Programming for Design
https://dynamobim.org
Other
1.74k stars 634 forks source link

Revit evaporates when creating multiple instances of Geometry library objects in Python node #1898

Closed frankfralick closed 10 years ago

frankfralick commented 10 years ago

I have run into an issue with python nodes that contain classes. What appears to be happening is that iteratively creating objects that use LibG results in Revit segfaulting, which is brutal when working in a big model. When debugging it shows System.AccessViolationException. Specifically I'm experiencing this with Surface.ByPerimeterPoints(). I'm not having any issues other than when creating instances in a loop, list comprehension, lambda expression etc.

The link below is a link to a simple definition that reproduces the error. There is a class that takes points. There is a method that creates calls Surface.ByPerimeterPoints. This only happens when creating several instances of the class. Creating one instance of the class and setting an attribute to a Geometry library object works as expected.

It may have nothing to do with classes at all, and more to do with the creation of several instances of a type that is in the Geometry library, but this is similar to what the actual project I'm working on is doing. If you move the creation of the surfaces out of the class method, I believe the same Revit evaporation will occur. Here is a screenshot from debugging the actual project I first observed this on.

To make sure it wasn't something I did while building, I installed your latest build from dynamobim.org, and the same thing happened.

This is a major hang up for me right now. Hopefully I'm an idiot and there is a simple explanation. I've tried to make this easy for you guys to look at. Please let me know I can provide additional information.

Link to definition: https://beck.box.com/s/nrv2sjw6lk74gdu9gckl

Screenshot from earlier today:

dynamorevit 2014-07-08 python segfault

lukechurch commented 10 years ago

Filed as high priority internal bug: http://adsk-oss.myjetbrains.com/youtrack/issue/MAGN-3882

Both @pboyer and @hlp are OOO today, but I expect we'll be able to get this looked at in pretty short order. We don't like seg faults.

There is no user action that should be able to cause a seg fault, so you can't be doing something wrong.

This is a major hang up for me right now.

Noted. We'll get on it.

Hopefully I'm an idiot

I'm afraid, I've never seen any evidence to support your hope ;-)

I've tried to make this easy for you guys to look at.

Appreciate it, it'll make it quicker for us to turn around the fix.

mjkkirschner commented 10 years ago

Hey Frank, I also had some trouble with protogeometry inside of python classes. I tried to replicate, but could not, I had not experienced a segfault on revit, only null references. Did you, while exploring this issue notice references to generated geometry returning null when you were expecting values?

I wrote my python code as a zero touch c# node and have not experienced the issue since, if you are being blocked you could try that route.

frankfralick commented 10 years ago

I thought about just writing it in c# but the thing is, I spent last week at the beach, fishing, reading, and not working. Then I came into the office Monday all bummed out but then realized "oh, all I have to do this week is write python and use dynamo". That realization sort of preserved my vacation buzz for two days. Nothing against c#, it's just that python and I don't get to hang out as much as we used to. So I'm really hoping this can get fixed, just from a general health and well being perspective.

ptierney commented 10 years ago

Fixed with fea7acdffadd0076e809e54782dffdf524eab3fe

frankfralick commented 10 years ago

@hlp Thank you very much! It appears to be working!