<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Function1 &#187; Unix</title>
	<atom:link href="http://www.function1.com/category/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.function1.com</link>
	<description>Discussing all things portal, WebCenter Interaction, WebCenter Suite, Sharepoint, and related technologies.</description>
	<lastBuildDate>Fri, 25 Jun 2010 15:20:23 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Solaris, PTSocketSelector, and sun.nio.ch.PollSelectorProvider&#8230;Oh My!</title>
		<link>http://www.function1.com/2008/10/solaris-ptsocketselector-and-sun-nio-ch-pollselectorprovider-oh-my/</link>
		<comments>http://www.function1.com/2008/10/solaris-ptsocketselector-and-sun-nio-ch-pollselectorprovider-oh-my/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 16:01:53 +0000</pubDate>
		<dc:creator>Brian Hak</dc:creator>
				<category><![CDATA[Bug]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Portal Server]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://wp.function1.com/index.php/247/uncategorized/solaris-ptsocketselector-and-sun-nio-ch-pollselectorprovider-oh-my</guid>
		<description><![CDATA[Howdy all.&#160; After a long hiatus I&#8217;m back to blog your socks off with some technical minutiae that will save a few of you lots of headaches, and help the rest of you get a good night&#8217;s sleep.
&#160;
Long Story Short (i.e. &#8220;Just the useful info, please&#8221;)&#160;

There&#8217;s a bug in the JDK that causes problems when [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Howdy all.<span style="mso-spacerun: yes">&nbsp; </span>After a long hiatus I&#8217;m back to blog your socks off with some technical minutiae that will save a few of you lots of headaches, and help the rest of you get a good night&#8217;s sleep.<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><strong>Long Story Short (i.e. &#8220;Just the useful info, please&#8221;)</strong></font></font></font><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p><span id="more-247"></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">There&#8217;s a bug in the JDK that causes problems when setting up certain types of Java server socket constructs on some Solaris 10 boxes.<span style="mso-spacerun: yes">&nbsp; </span>This bug will likely manifest itself in one of the following ways in your ALUI environment:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">1)<span style="mso-spacerun: yes">&nbsp; </span>You&#8217;re running the ptlogging utility and see your logs filled up with something like:</font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#000000" size="3"></font>&nbsp;</p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em>PTSelectorThread_17679958<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em>com.plumtree.openkernel.impl.openhttp.core.network.PTSocketSelector<span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp; </span>Unexpected exception.<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em>java.io.IOException: Invalid argument<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.DevPollArrayWrapper.poll0(Native Method)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.DevPollArrayWrapper.poll(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.DevPollSelectorImpl.doSelect(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.SelectorImpl.select(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.SelectorImpl.select(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;</span>at com.plumtree.openkernel.impl.openhttp.core.network.PTSocketSelector.run(PTSocketSelector.java:400)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at java.lang.Thread.run(Unknown Source)</em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#000000" size="3"><em></em></font>&nbsp;</p>
</blockquote>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">2) Portal starts up fine, but it can&#8217;t connect to any remote servers, giving you the same stacktrace as above:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em>java.io.IOException: Invalid argument<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.DevPollArrayWrapper.poll0(Native Method)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.DevPollArrayWrapper.poll(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.DevPollSelectorImpl.doSelect(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.SelectorImpl.select(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at sun.nio.ch.SelectorImpl.select(Unknown Source)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at com.plumtree.openkernel.impl.openhttp.core.network.PTSocketSelector.run(PTSocketSelector.java:400)<o:p></o:p></em></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>at java.lang.Thread.run(Unknown Source)<o:p></o:p></em></font></font></font></p>
</blockquote>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">So what&#8217;s a good god-fearing person like yourself to do?<span style="mso-spacerun: yes">&nbsp; </span>Well, if you act now, we&#8217;ll send you TWO workarounds for the price of one:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">1) Have an SA up the hard File Descriptor (FD) limit on the server to 8193 or greater by editing /etc/system to have the line:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p></o:p><font size="3"><font color="#000000"><font face="Times New Roman"><em>set rlim_fd_max=8193<o:p></o:p></em></font></font></font></p>
</blockquote>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Note: You&#8217;ll need to bounce the box after this change.<span style="mso-spacerun: yes">&nbsp; </span>You can then verify it worked by running:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p></o:p><font size="3"><font color="#000000"><font face="Times New Roman"><em>ulimit -n -H<o:p></o:p></em></font></font></font></p>
</blockquote>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Which should return a number &gt;= 8193.<span style="mso-spacerun: yes">&nbsp; </span>Sadly, this approach will probably have the SA asking you why you want to make the change, which means you&#8217;ll have to read the technical details below&#8230;.so onto option #2<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">2) Tell the appropriate JVMs to use a different Socket Selector configuration.<span style="mso-spacerun: yes">&nbsp; </span>You do this by passing the following option to the JVM:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em>-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider<o:p></o:p></em></font></font></font></p>
</blockquote>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Depending on what ALUI component you&#8217;re updating, you may pass this option in different ways.<span style="mso-spacerun: yes">&nbsp; </span>For instance, if you&#8217;re dealing with one of the back-end servers (Collab, Studio, etc), you&#8217;ll want to update wrapper.conf to add additional arguments like:<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><em>wrapper.java.additional.7=-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider<o:p></o:p></em></font></font></font></p>
</blockquote>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Note: Replace &#8220;7&#8243; in the above line with the appropriate number for your wrapper file.<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Or you may just need to update a shell script somewhere that&#8217;s kicking off Tomcat/Weblogic/etc.<span style="mso-spacerun: yes">&nbsp; </span>Note that these scripts all have their own Shell variables for holding additional Java arguments, so just look through them and update as appropriate.<span style="mso-spacerun: yes">&nbsp; </span>If you have problems, feel free to post questions here and we&#8217;ll do our best to help out.<o:p></o:p></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p><font face="Times New Roman" color="#000000" size="3"></font></o:p>&nbsp;</p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman"><strong>Long Story Long (i.e. &#8220;I&#8217;m kind of a geek, and I&#8217;m sitting at work with nothing else to do, so give me the details&#8221;)<o:p></o:p></strong></font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">So ALUI uses the NIO java packages that were introduced in Java 1.4.<span style="mso-spacerun: yes">&nbsp; </span>FWIW, I always thought NIO stood for Non-blocking IO, but a little Googling reminds me that it&#8217;s actually New IO&#8230;silly me.<span style="mso-spacerun: yes">&nbsp; </span>In any case, the NIO packages let you do some cool things with sockets to more efficiently manage high-volume connections.&nbsp; The under-lying problem you&#8217;re running into is that out-of-the-box Selector implementation in the JDK uses /dev/poll to allocate 8192 File Descriptors (FD) for use by the selector, and 8192 exceeds the nofiles (Number of File Descriptors) limit on your server.<span style="mso-spacerun: yes">&nbsp; </span>So, you can either bump up the server FD limit ala work-around #1 above, or tell Java to use a different selector implementation that doesn&#8217;t allocate all those FDs ala option #2 above.<span style="mso-spacerun: yes">&nbsp; </span>If you&#8217;re interested in more detail, you can find the Sun bug on the issue <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6322825">here</a>.</font></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><o:p></o:p>&nbsp;</p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font size="3"><font color="#000000"><font face="Times New Roman">Until next time&#8230;thanks for reading!</font></font></font><o:p><font face="Times New Roman" color="#000000" size="3">&nbsp;</font></o:p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.function1.com/2008/10/solaris-ptsocketselector-and-sun-nio-ch-pollselectorprovider-oh-my/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
