This I don't understand at all.<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
reload() in crypto.c should only be called if the module is upgraded, not if it is unloaded and later loaded again.<br>
<br>
/Sverker, Erlang/OTP<br>
<br>
</blockquote></div>Thanks for pointing this. I'm sorry I made a wrong conclusion for the workaround in modifying reload() function. I wronly modfied reload() in 15B02.<br><br>I have some new findings on this issue:<br>
I find the latest 15B02 (without any modification) does not cause core dump in running couchDB test suite. Digging this issue further, there's a subtle difference between 15B02 and 15B01 in crypto.so. <br>
In 15B01, crypto.so explicitly link libssl.so, while in 15B02 it does not.<br><br>And more importantly, the libssl.so built by Sun/Oracle seems built with "-z nodelete" meaning RTLD_NODELETE. ("elfdump -d" can show that).<br>
In 15B01, loading crypto.so causes libssl.so to be loaded, since libssl.so depends on libcrypto.so, libcrypto.so is somehow promoted to RTLD_NODELETE (using solaris runtime LD debugger can show this). So, libcrypto.so is unloadable in dlclose().<br>
In 15B02, when running couchDB test suite, unloading crypto.so causes libcrypto.so unloaded too, then later reloading both crypto.so and libcrypto.so would not cause previous problem. <br><br>A new question, each time loading crypto.so will cause load() to be called, then it means CRYPTO_set_mem_functions() should be called again, I assume it should correctly set the callback funcs. But from instruction-level tracing and the src, it simply returned in line 129 because "!allow_customize" is true. <br>
<br>(dbx) stepi <br>t@1 (l@1) stopped in CRYPTO_set_mem_functions at 0xfd053b0c<br>0xfd053b0c: CRYPTO_set_mem_functions+0x0034: retl <br><br> 125 int CRYPTO_set_mem_functions(void *(*m)(size_t), void *(*r)(void *, size_t), <br>
126 void (*f)(void *))<br> 127 {<br> 128 if (!allow_customize)<br> 129 return 0;<br> 130 if ((m == 0) || (r == 0) || (f == 0))<br> 131 return 0;<br>
132 malloc_func=m; malloc_ex_func=default_malloc_ex;<br> 133 realloc_func=r; realloc_ex_func=default_realloc_ex;<br> 134 free_func=f;<br> 135 malloc_locked_func=m; malloc_locked_ex_func=default_malloc_locked_ex; <br>
136 free_locked_func=f;<br> 137 return 1;<br> 138 }<br><br><br><br><br><br><br>