[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Q: DRb and recycled object error?

Ville Mattila

3/1/2005 6:51:00 AM


Hello,

I'm having a problem with my DRb application. It goes like this:

server A

def foo(match)
@bar.each do |b|
if b == match
return b
end
end
end

client B

[1,2,3].each do |c|
f = DRbObject.new(nil, A)
foo = f.foo
do stuff some time...
foo.inspect # <-- this causes recycled object error"
end

if foo method is changed so that
def foo(match)
@container = Array.new
@bar.each do |b|
if b == match
@container.push(b)
return b
end
end
end

I will no longer get recycled error. But this seems quite bad. I know
have to manually clear @container. Is there way to say Server that this 'b'
is a drb reference do not garbage collect it?

- Ville
7 Answers

Lew

8/15/2010 12:54:00 PM

0

schreef RedGrittyBrick:
>> If you can't use an IDE, then running Ant or Make etc from inside your
>> editor has to be the next best thing.

For certain values of "the next best". For delivery and deployment it's one
of the worst things because it potentially locks you in to a particular
version of a particular IDE.

An Ant build forces you to have all the dependencies for the project at hand
and does not introduce additional dependencies. It works the same regardless
of the different IDEs used. It consolidates the build and path information
into one or a small number of build descriptor files, not scattered among
various ".project" or ".settings" files with auto-shifting content. With
judicious use of (downward-) relative paths and environment variables, the
build.xml liberates you from hard-coded drives or paths.

Project after project where I've worked has had build and deployment issues
that arise from the seductive apparent convenience of sharing IDE-specific
metadata. These issues have included test suites that work differently in the
test environment from the developers', long hours of manual labor translating
IDE-specific project dependencies into deployment-time build scripts,
conflicting JARs, broken builds (ones that don't compile), and huge time
investment to upgrade a project to a newer IDE version.

IDE-specific project files should be eliminated from the project's build
protocols with extreme prejudice.

--
Lew

Tom Anderson

8/15/2010 11:21:00 PM

0

Tom Anderson

8/15/2010 11:36:00 PM

0

RedGrittyBrick

8/16/2010 9:51:00 AM

0

On 16/08/2010 00:21, Tom Anderson wrote:
> On Sun, 15 Aug 2010, jaap wrote:
>
>> Op 14-08-10 21:59, schreef RedGrittyBrick:
>>> On Sat, 14 Aug 2010 13:14:33 +0200
>>> "Martijn Mulder"<i@m> wrote:
>>
>>> If you can't use an IDE, then running Ant or Make etc from inside
>>> your editor has to be the next best thing.
>>
>> Eclipse runs very easy, you can simply inzip the files and let it run.
>> You can use it on nearly every computer.
>
> I've held off running Eclipse on my home computer, but this comment
> inspired me to try it. It's an EeePC 1001HA - a 1.6 GHz Atom N270 with 1
> GB of memory and a 1024x600 screen. Eclipse Helios installs and does in
> fact run. It takes time to start up and to warm up after that (eg the
> first time displaying the 'new class' dialogue is painfully slow, but
> fine after that), and it takes a fair while to display the
> autocompletion menu for String and similarly well-endowed classes.
>

I'm impressed that a modern IDE is usable on a computer designed for
surfing the web inexpensively.

Looking forward to Call Of Duty framerates and Photoshop filter timings
on 24MP images. ;-)

--
RGB

RedGrittyBrick

8/16/2010 9:53:00 AM

0

On 15/08/2010 13:54, Lew wrote:
> schreef RedGrittyBrick:
>>> If you can't use an IDE, then running Ant or Make etc from inside your
>>> editor has to be the next best thing.
>
> For certain values of "the next best".

Those where the context is rapid cycle of write, compile, run?

--
RGB

Tom Anderson

8/16/2010 12:21:00 PM

0

Lew

8/16/2010 1:08:00 PM

0

Lew wrote:
>> For certain values of "the next best". For delivery and deployment
>> it's one of the worst things because it potentially locks you in to a
>> particular version of a particular IDE.

Tom Anderson wrote:
> To a particular IDE, yes. To a particular version? I've been looking at

Yep. Upgrading from Rational Application Developer (Eclipse based, BTW) from
version 6 to version 7 for a team was a nightmare of metadata-file editing on
a large team a few years ago.

> Eclipse metadata files since 3.3, and they haven't changed much. More

It doesn't take "much" if the "not much" is involved in your particular case.

> specifically, the .project and .classpath haven't changed at all, as far
> as i can tell (caveat: we have quite simple projects, just java [sic] projects
> with the java [sic] builder). Some of the more mysterious files in the
> workspace global directories (eg variablesAndContainers.dat) have, but
> not hugely, and you don't share those anyway, so it's largely irrelevant.

"You don't share those anyway" - making my point that IDE-specific files can
be very bad to share.

> I think there's a NetBeans plugin that lets it read Eclipse .project and
> .classpath files, but i don't know how up to date it is, and i wouldn't
> want to rely on it. It would be really nice if IDE vendors could
> standardise on metadata files, to avoid this lockin problem, and also
> enable all sorts of new tools, but i realise that's a pipe dream.

Nice but unnecessary. Just have the metadata files be irrelevant. Besides,
even standardizing on the format doesn't solve the problem - these files
contain hard-coded path information and the like that is specific to each
developer, not just the project or the brand of IDE.

Lew:
>> An Ant build forces you to have all the dependencies for the project
>> at hand and does not introduce additional dependencies.

tom:
> Doing your build with ant introduces ant as a dependency, and nothing
> else. Doing your build with Eclipse introduces Eclipse as a dependency,
> and nothing else. I don't see the difference.

Eclipse (or whatever) adds a lot more complexity in its dependency. Ant does
not introduce under-the-hood changes to your metadata files automagically.
Eclipse does. Ant does not require multiple entries for dependencies into
multiple configuration files. Eclipse does. Ant doesn't assume the presence
of an entire infrastructure of JARs (org.eclipse.blahdiblah.packagestuff.jar).
Eclipse does. Ant is invoked from the command line and is independent of
the IDE used to build them. Eclipse is not. Ant dependencies are limited
pretty much to "use the tool". Eclipse dependencies are pernicious and
pervasive. Ant is upwardly compatible. Eclipse is not. Ant is
user-extensible with simplicity. Eclipse is not. Ant is geared specifically
to deployment. Eclipse is geared to construction and is more general. Ant is
the standard build tool. Eclipse is not.

The differences are myriad.

Lew:
>> It consolidates the build and path information into one or a small
>> number of build descriptor files, not scattered among various
>> ".project" or ".settings" files with auto-shifting content.

tom:
> I don't see this as an advantage, but rather, as a significant
> disadvantage. The build information is better off stored in multiple
> small files, one per module, than consolidated in one big file. This is
> the case regardless of IDE, build system, etc.

All right. Use multiple build files then. Advantage: Ant. Regardless of
IDE, project structure, etc.

> ... Projects i've worked on have used IDE-specific
> build processes, and that hasn't caused any pain. Indeed, we've
> *reduced* the amount of pain we feel by using more of it. For instance,
> at one point, we maintained Eclipse-independent classpath metadata, so
> we could run code from the command line as part of the build. This was
> painful. We then wrote some code to parse Eclipse's files to extract the
> information automatically. This made things a lot easier and more
> reliable, because we let Eclipse do the heavy lifting of keeping that
> data correct.

Except that you still have things like class paths specified in up to four
places per project with Eclipse - "build path", "project dependencies", "EAR
dependencies" and "aspects". There may be others. Eclipse, like Ant, doesn't
do the heavy lifting; it captures the decisions made by humans.

> I'd be interested to hear more about the instances you mention. Why were
> the development and test test suites different? Why did you have to

God knows. For some reason instead of using the JUnit test framework they
invoked test code via 'main()'. I didn't create the process. Excuse me, the
"process".

> translate the IDE build into another form (which i can see you might
> need) by hand? How would you have avoided having conflicting JARs by not

Because we didn't have custom tools to translate the IDE files into Ant files.

> sharing IDE metadata? How was an IDE responsible for a broken build?
> What did you have to do when upgrading your IDE?

I forget the details, but it involved replacing lines in certain configuration
files to reflect new features in the newer IDE version.

Since IDE metadata was formed project by project by different developers in
isolation from each other, often they each would choose JAR versions
independently and thus occasionally conflictingly. With a centralized build
process those conflicts are noticed earlier in the process, and listed in the
build.xml file(s) where they're far more visible. Emergently this gives Ant
an edge for conflict resolution.

Lew:
>> IDE-specific project files should be eliminated from the project's
>> build protocols with extreme prejudice.

tom:
> Duplication should be eliminated from the project's build protocols with
> extreme prejudice. You're using an IDE, so maintaining an
> IDE-independent build process is duplication.

Is it your argument that having more than one developer is duplication, since
each have a separate working copy of the project?

Since I don't favor an IDE-based build process, an IDE-independent build
process would have nothing to duplicate, so therefore it is not duplication.

--
Lew