<!-- 
RSS generated by JIRA (4.4#649-r158309) at Wed May 22 02:35:31 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/NREPL-21/NREPL-21.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[NREPL-21] Sometimes *err*/*out*/value messages are surprisingly ordered</title>
                <link>http://dev.clojure.org/jira/browse/NREPL-21</link>
                <project id="10022" key="NREPL">tools.nrepl</project>
                        <description>&lt;p&gt;As described here: &lt;a href=&quot;https://github.com/technomancy/leiningen/issues/631&quot;&gt;https://github.com/technomancy/leiningen/issues/631&lt;/a&gt;, the &amp;#42;out&amp;#42;, &amp;#42;err&amp;#42;, and value printing are ordered differently than expected sometimes. &lt;/p&gt;

&lt;p&gt;There are 2 things left here:&lt;br/&gt;
(1) The return value can sometimes print before synchronous prints to err/out. Synchronizing all the printing on the REPLy side doesn&apos;t seem to help. An example case:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;=&amp;gt; (&lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; (.print *err* &lt;span class=&quot;code-quote&quot;&gt;&quot;one&quot;&lt;/span&gt;) (print &lt;span class=&quot;code-quote&quot;&gt;&quot;two&quot;&lt;/span&gt;) (print &lt;span class=&quot;code-quote&quot;&gt;&quot;three&quot;&lt;/span&gt;))
niltwothreeone&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;(2) Calling .println() on the &amp;#42;out&amp;#42;/&amp;#42;err&amp;#42; streams doesn&apos;t necessarily flush the stream. Changing this may have performance/network ramifications, but generally it seems like surprising behavior. An example case: &lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;user=&amp;gt; (&lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; (.println *out* &lt;span class=&quot;code-quote&quot;&gt;&quot;one&quot;&lt;/span&gt;) (.print *err* &lt;span class=&quot;code-quote&quot;&gt;&quot;two&quot;&lt;/span&gt;) (.print *err* &lt;span class=&quot;code-quote&quot;&gt;&quot;three&quot;&lt;/span&gt;) 1)
twothreeone
1&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I&apos;d expect two .print() calls to different streams to have undefined ordering, but the other orderings were all surprising.&lt;/p&gt;

&lt;p&gt;The attached patch forces flushes to avoid both of these, for (1) immediately before sending the value message, and for (2) on the &quot;normal&quot; PrintStream &lt;span class=&quot;error&quot;&gt;&amp;#91;autoFlush&amp;#93;&lt;/span&gt; cases of println, printf, or format.&lt;/p&gt;

&lt;p&gt;Side note: I couldn&apos;t get any tests to fail in this scenario, even after doing some reworking of the streams used in tests, but I kept one new test in this patch anyway. Turns out it&apos;s hard to write tests that really make sure .flush() gets called.&lt;/p&gt;</description>
                <environment></environment>
            <key id="15541">NREPL-21</key>
            <summary>Sometimes *err*/*out*/value messages are surprisingly ordered</summary>
                <type id="1" iconUrl="http://dev.clojure.org/jira/images/icons/bug.gif">Defect</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="cemerick">Chas Emerick</assignee>
                                <reporter username="trptcolin">Colin Jones</reporter>
                        <labels>
                    </labels>
                <created>Sun, 17 Jun 2012 18:06:03 -0500</created>
                <updated>Wed, 20 Jun 2012 06:58:58 -0500</updated>
                    <resolved>Wed, 20 Jun 2012 06:58:58 -0500</resolved>
                                                                    <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="28882" author="cemerick" created="Wed, 20 Jun 2012 06:58:58 -0500"  >&lt;p&gt;Merged, thanks!&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11330" name="0001-Flush-out-err-before-sending-value.patch" size="2963" author="trptcolin" created="Sun, 17 Jun 2012 18:06:03 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10001">Code</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>