clojure.java.shell hanging issues

113 views
Skip to first unread message

kovas boguta

unread,
Jan 5, 2011, 5:07:56 PM1/5/11
to clo...@googlegroups.com, djpo...@djpowell.net
Hello everyone,

A while back there was some discussion on the fact that
clojure.java.shell can hang under various circumstances, and some
patches were submitted:

http://dev.clojure.org/jira/browse/CLJ-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

But doesn't seem to have made it into the release.

Is there a known way to avoid these issues? I suspect my particular
problem is the output of my process is too big for the buffer.

Perhaps a reasonable hack is to increase the buffer size, but I
wouldn't know which one to increase. Is it
clojure.contrib.io/*buffer-size* ?

I'm also running several instances of clojure.java.shell/sh in a pmap,
I assume that is safe?

Thanks in advance.

Stuart Halloway

unread,
Jan 5, 2011, 7:16:41 PM1/5/11
to clo...@googlegroups.com
(1) The ticket you reference is marked completed and the patches went in last July. Is it possible you are seeing a different problem?

(2) Clojure does not depend on anything in the clojure.contrib namespace.

(3) Running inside a pmap should be ok, but make sure you understand the interleavings you are seeing.

Cheers,
Stu

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

kovas boguta

unread,
Jan 5, 2011, 7:41:34 PM1/5/11
to clo...@googlegroups.com
Hi, thanks for the quick response.

Looking at the source code I'm not sure if the patches were applied.
Maybe there was a "regression". The symptoms seem consistent with what
was supposed to have been fixed.

Following the clojure.org api docs, I clicked through on the source code link on

http://richhickey.github.com/clojure-contrib/shell-api.html

to get to

https://github.com/richhickey/clojure-contrib/blob/a1c66df5287776b4397cf3929a5f498fbb34ea32/src/main/clojure/clojure/contrib/shell_out.clj#L83

and that doesn't look like the code in the patches, but maybe its
pointing at the wrong place?

I also tried to find the source code in
https://github.com/clojure/clojure-contrib but failed.

kovas boguta

unread,
Jan 5, 2011, 7:43:24 PM1/5/11
to clo...@googlegroups.com
Stumbled on another branch of documentation, the code described at

https://github.com/clojure/clojure-contrib/blob/6e721ff777dd52801cafe693868d8118a62076de/src/main/clojure/clojure/contrib/shell.clj#L86

is also without the patches.

Stuart Halloway

unread,
Jan 5, 2011, 8:00:59 PM1/5/11
to clo...@googlegroups.com
All the code you are referring to is in clojure.contrib. Note the comment at the top of the files:

;; DEPRECATED in 1.2: Promoted to clojure.java.shell

clojure.java.shell is clojure itself, you should not need contrib at all.

Cheers,
Stu

Ken Wesson

unread,
Jan 5, 2011, 8:07:37 PM1/5/11
to clo...@googlegroups.com
On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway
<stuart....@gmail.com> wrote:
> All the code you are referring to is in clojure.contrib. Note the comment at the top of the files:
>
> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell

At the top of which files? If you mean the library's source code, it's
very likely he didn't read a single line of it -- just installed the
contrib jar along with Clojure and then :required or :used it.

If something people have been using in version x is deprecated in
later version y, this needs to be announced somewhere more prominently
than in its source code, like, oh, say, the main documentation page.
Better yet, the compiler should say something -- javac emits warnings
if you call a method marked deprecated with Javadoc; maybe we need a
{:deprecated true} meta tag that can be used on defns and that makes
clojure emit warnings when deprecated functions are called? (These can
be printlns to stderr in the same vein as the warnings generated by
(set! *warn-on-reflection* true).)

kovas boguta

unread,
Jan 5, 2011, 8:27:30 PM1/5/11
to clo...@googlegroups.com
Actually I did look at the source, but was just looking for the
relevant bits of code rather than perusing the frontmatter.

The main "problem" was just that there are a lot of references to the
old lib lying around in various forms of documentation that seemed
current.

Stuart Halloway

unread,
Jan 5, 2011, 9:33:43 PM1/5/11
to clo...@googlegroups.com
If you send me a pointer to the link that still pointed to richhickey@github I will fix it.

Thanks,
Stu

Stuart Halloway

unread,
Jan 5, 2011, 9:40:17 PM1/5/11
to clo...@googlegroups.com
> On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway
> <stuart....@gmail.com> wrote:
>> All the code you are referring to is in clojure.contrib. Note the comment at the top of the files:
>>
>> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell
>
> At the top of which files? If you mean the library's source code, it's
> very likely he didn't read a single line of it -- just installed the
> contrib jar along with Clojure and then :required or :used it.
>
> If something people have been using in version x is deprecated in
> later version y, this needs to be announced somewhere more prominently
> than in its source code, like, oh, say, the main documentation page.

This is partially in place already. Deprecated namespaces are marked as such with {:deprecated true}, and the top of the documentation page shows this (e.g. http://clojure.github.com/clojure-contrib/shell-api.html).

However, the styling of the deprecation warning is such that it can be easily missed.

> Better yet, the compiler should say something -- javac emits warnings
> if you call a method marked deprecated with Javadoc; maybe we need a
> {:deprecated true} meta tag that can be used on defns and that makes
> clojure emit warnings when deprecated functions are called? (These can
> be printlns to stderr in the same vein as the warnings generated by
> (set! *warn-on-reflection* true).)

Ticket created: http://dev.clojure.org/jira/browse/CLJ-706.

Thanks,
Stu


kovas boguta

unread,
Jan 5, 2011, 9:48:14 PM1/5/11
to clo...@googlegroups.com
One effective way to do it is to change the background color of either
the whole page, or of the title (eg API for shell - clojure-contrib
v1.2 (stable))

An analogous case that is handled well I think:

http://reference.wolfram.com/mathematica/NonlinearRegression/ref/NonlinearRegress.html


On Wed, Jan 5, 2011 at 6:40 PM, Stuart Halloway

Ken Wesson

unread,
Jan 5, 2011, 10:24:15 PM1/5/11
to clo...@googlegroups.com
On Wed, Jan 5, 2011 at 9:40 PM, Stuart Halloway

<stuart....@gmail.com> wrote:
>> On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway
>> <stuart....@gmail.com> wrote:
>>> All the code you are referring to is in clojure.contrib. Note the comment at the top of the files:
>>>
>>> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell
>>
>> At the top of which files? If you mean the library's source code, it's
>> very likely he didn't read a single line of it -- just installed the
>> contrib jar along with Clojure and then :required or :used it.
>>
>> If something people have been using in version x is deprecated in
>> later version y, this needs to be announced somewhere more prominently
>> than in its source code, like, oh, say, the main documentation page.
>
> This is partially in place already. Deprecated namespaces are marked as such with {:deprecated true}, and the top of the documentation page shows this (e.g. http://clojure.github.com/clojure-contrib/shell-api.html).
>
> However, the styling of the deprecation warning is such that it can be easily missed.

The granularity is limited to whole namespaces?

Ick.

How about:

{:deprecated true} metadata can be attached to any var.

(defnd ... ) sets this, so you can just change "defn" to "defnd" to
deprecate a function.

Deprecation shows up in the generated docs, along with the arities,
docstring, etc.; and that includes on generated web pages like those
for the contrib libraries.

On generated web pages it can show up in blinking red 100 point Gothic
if you like.

And the compiler emits a warning when it compiles something that
references a deprecated var, just as it does if *warn-on-reflection*
is set and it compiles an interop call that needs reflection.

Sean Corfield

unread,
Jan 5, 2011, 10:46:28 PM1/5/11
to clo...@googlegroups.com
On Wed, Jan 5, 2011 at 4:41 PM, kovas boguta <kovas....@gmail.com> wrote:
> Following the clojure.org api docs, I clicked through on the source code link on
>
> http://richhickey.github.com/clojure-contrib/shell-api.html

I'm curious as to how you got here? I went to clojure.org, clicked
API, clicked clojure.java.shell in the left column and ended up here:

http://clojure.github.com/clojure/clojure.java.shell-api.html

Clicking the source link took me here:

https://github.com/clojure/clojure/blob/a2c95ef1bf6e34a455b469ac9ff18ddff7e9cef7/src/clj/clojure/java/shell.clj#L79

Looks like there are still erroneous links to out of date docs and the old repo?
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

kovas boguta

unread,
Jan 5, 2011, 11:07:24 PM1/5/11
to clo...@googlegroups.com
In retrospect it probably wasn't clojure.org, but an adjacent tab I
opened from a google search. richhickey.github.com has really high
pagerank :) which can confuse things; also all these branches have
nearly the same visual identity which makes it easy to forget what is
going on.

Miki

unread,
Jan 6, 2011, 12:12:15 PM1/6/11
to clo...@googlegroups.com

Looking at the source code I'm not sure if the patches were applied.
Maybe there was a "regression". The symptoms seem consistent with what
was supposed to have been fixed.

Following the clojure.org api docs, I clicked through on the source code link on

http://richhickey.github.com/clojure-contrib/shell-api.html

Can we add a notice on the http://richhickey.github.com/clojure... that the "official" docs are at http://clojure.github.com/clojure..?
I've seen several people getting confused by that.
Reply all
Reply to author
Forward
0 new messages