<?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>Fabio Falcinelli &#187; JNI</title>
	<atom:link href="http://www.fabiofalcinelli.it/tag/jni/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fabiofalcinelli.it</link>
	<description>Interessi e appunti</description>
	<lastBuildDate>Tue, 27 Sep 2011 15:52:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JNI su HP-UX, le dimensioni dello stack contano</title>
		<link>http://www.fabiofalcinelli.it/2010/03/jni-su-hp-ux-le-dimensioni-dello-stack-contano/</link>
		<comments>http://www.fabiofalcinelli.it/2010/03/jni-su-hp-ux-le-dimensioni-dello-stack-contano/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 18:39:00 +0000</pubDate>
		<dc:creator>Fabio</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[BoKS]]></category>
		<category><![CDATA[HP-UX]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JNI]]></category>
		<category><![CDATA[pthread]]></category>
		<category><![CDATA[Stacksize]]></category>
		<category><![CDATA[tusc]]></category>

		<guid isPermaLink="false">http://www.fabiofalcinelli.it/?p=355</guid>
		<description><![CDATA[Arrugginito forse un po&#8217;, quando si passa tanto tempo a fare altro ci si dimentica di avere anche uno spazio web dove annotare quei piccoli successi che potrebbero tornare utili ad altri, ma anche a te semmai te ne dovessi dimenticare :) Il problema di fondo era che la chiamata JNI_CreateJavaVM produceva il segnale SIGABRT [...]]]></description>
			<content:encoded><![CDATA[<p>Arrugginito forse un po&#8217;, quando si passa tanto tempo a fare altro ci si dimentica di avere anche uno spazio web dove annotare quei piccoli successi che potrebbero tornare utili ad altri, ma anche a te semmai te ne dovessi dimenticare :)</p>
<p>Il problema di fondo era che la chiamata JNI_CreateJavaVM produceva il segnale SIGABRT quando invocato all&#8217;interno di un altro framework, nello specifico stavo utilizzando l&#8217;SDK BoKS.</p>
<p>La porzione di codice interessata, a parte dovuti accorgimenti, era del tutto coerente con quanto riportato da HP al link</p>
<p><a href="http://www.docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html" target="_blank">http://www.docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html</a></p>
<p>Provando ad utilizzare i parametri di inizializzazione della VM più svariati non si è cavato un ragno dal buco, seguendo comunque le linee guida riportate qui <a href="http://www.docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html#primordial ">http://www.docs.hp.com/en/JAVAPROGUIDE/JNI_java2.html#primordial</a>, si è ipotizzato da subito un problema con lo stacksize su HP-UX, su Solaris, infatti, non erano stati riscontrati problemi di sorta.</p>
<p>Una sessione con <strong>tusc</strong> ha confermato quanto supposto:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#6 kwakeup(PTH_CONDVAR_OBJECT, 0x60000000000ea400, WAKEUP_ONE, 0x9fffffff7f63cb50) = 0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 ksleep(PTH_CONDVAR_OBJECT, 0x60000000000ea400, 0x60000000000d75b8, NULL) = 0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#6 gettimeofday(0x9fffffff7f63cb30, NULL) ........ = 0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 write(1, 0x9fffffffef4c0400, 43) .............. = 43</span><br />
E r r o r &nbsp; o c c u r r e d &nbsp; d u r i n g &nbsp; i n i t i a l i z a<br />
t i o n &nbsp; o f &nbsp; V M \n<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 write(1, 0x60000000001683a0, 28) .............. = 28</span><br />
j a v a . l a n g . S t a c k O v e r f l o <span style="color: #c20cb9; font-weight: bold;">w</span> E r r o r<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 write(1, 0xc000000015cf08b8, 1) ............... = 1</span><br />
\n<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 unlink(&quot;/var/tmp/hsperfdata_boksa/19196&quot;) ..... = 0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 sigaction(SIGILL, 0x9fffffffef7c6740, NULL) ... = 0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 sigprocmask(SIG_UNBLOCK, NULL, 0x9fffffffef4c0b80) = 0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 sigaction(SIGABRT, NULL, 0x9fffffffef4c0ba0) .. = 0</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 getpid() ...................................... = 19196 (19194)</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 &nbsp; Received signal 6, SIGABRT, in kill(), [0x9fffffffef76bfd0]</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">19196</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #666666; font-style: italic;">#2 &nbsp; &nbsp; Siginfo: sent by pid 19196 (uid 600), si_errno: 0</span></div></div>
<p>La soluzione?</p>
<p>Un semplice export della variabile <strong>PTHREAD_DEFAULT_STACK_SIZE</strong> a <strong>524288</strong>.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PTHREAD_DEFAULT_STACK_SIZE</span>=<span style="color: #000000;">524288</span></div></div>
<p>Si sarebbe anche potuta usare la chiamata pthread_default_stacksize_np(), ma poiché la parte di codice che crea i thread non è personalizzabile in quel dato SDK, l&#8217;export della variabile d&#8217;ambiente è stata l&#8217;unica soluzione attuabile.</p>
<p>Alla prossima!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fabiofalcinelli.it/2010/03/jni-su-hp-ux-le-dimensioni-dello-stack-contano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

