java.sql.BatchUpdateException: IO Error: Connection reset
posted @ 2017-02-20 09:28 InPractice 閱讀(1302) | 評論 (0) | 編輯 收藏
隨筆 - 53, 文章 - 0, 評論 - 3, 引用 - 0
|
java.sql.BatchUpdateException: IO Error: Connection reset
during analysis of "IO Error: Connection reset", many articles mentioned that it could be caused by java security code (accessing /dev/random) used in JDBC connection. However it is not the root cause in my case.
In my environment, Java already use /dev/urandom.
1. $JAVA_HOME/jre/lib/security/java.security
securerandom.source=file:/dev/./urandom
2. check with strace.
only -Djava.security.egd=file:/dev/../dev/urandom will trigger system call (read on /dev/urandom)
all other other path format like below are OK.
-Djava.security.egd=file:/dev/./urandom
-Djava.security.egd=file:///dev/urandom
3. Keep checking the retropy size, I have never seen it is exhaused.
while [ 1 ];
do
cat /proc/sys/kernel/random/entropy_avail
sleep 1
done
usually the avail is in the range from 1000 to 3000.
so far, there is no clue about the root cause of "IO Error: Connection reset".
posted @ 2017-02-20 09:28 InPractice 閱讀(1302) | 評論 (0) | 編輯 收藏 Lessons learned - Oracle GI and Database Installation on SUSE 12
I encountered many issue during installation of Oracle Grid Infrastructure(GI) and Database;
with the help of ariticle and documents found through Google search engine,
I finally made it. for records, here is the details issues encountered and solutions applied.
Major issues were encountered during GI installation.
Pre-installation tasks.
Issue 1: swapspace is not big enough; (1.3.1 Verify System Requirements)
grep MemTotal /proc/meminfo
264G
grep SwapTotal /proc/meminfo
2G
during OS installation, I take default option and swap space is only 2G.
Oracle recommend to have more than 16G swap space in case of more that 32G RAM.
dd if=/dev/zero of=/home/swapfile bs=1024 count=33554432
33554432+0 records in
33554432+0 records out
34359738368 bytes (34 GB) copied
mkswap /home/swapfile
mkswap /home/swapfile
chmod 0600 /home/swapfile
lessons learned: setup swap space properly according to DB requirement when installing OS.
Issue 2: cannot find oracleasm-kmp-default from Oracle site.
(1.3.6 Prepare Storage for Oracle Automatic Storage Management)
install oracleasmlib and oracleasm-support is easy, just download them from Oracle and install them;
Originally oracleasm kernel is provided by Oracle, but now I cannot find it from Oracle; finally I
realized that oracleasm kernel is now provided by OS vendor;
In my case, it should be installed from SUSE disk;
a. to get its name oracleasm-kmp-default
zypper se oracle
b. map dvd and install
zypper in oracleasm-kmp-default
rpm -qa|grep oracleasm
oracleasm-kmp-default-2.0.8_k3.12.49_11-3.20.x86_64
oracleasm-support-2.1.8-1.SLE12.x86_64
oracleasmlib-2.0.12-1.SLE12.x86_64
asm configure -i
asm createdisk DATA /dev/<...>
asm listdisks
--DATA
ls /dev/oracleasm/disks
Installation tasks:
Issue 3: always failed due to user equivalence check after starting installer OUI with user oracle.
however if I manully check with runcluvfy, no issue found at all.
./runcluvfy.sh stage -pre crsinst -n
posted @ 2016-07-28 16:55 InPractice 閱讀(258) | 評論 (0) | 編輯 收藏 卸載Ubuntu需要注意的地方很多年前裝了Ubuntu和Windows的雙系統(tǒng),最近因為有了專門的電腦來裝Ubuntu,所以把原先電腦上的Ubuntu卸載了,結果系統(tǒng)不能引導了。因為GRUB的原理是控制權從MBR到Ubuntu系統(tǒng)盤,然后Ubuntu系統(tǒng)盤再提供對windows的引導。現(xiàn)在Ubuntu系統(tǒng)被卸載了。這個啟動的鏈條也就斷了。 posted @ 2011-04-11 18:19 InPractice 閱讀(641) | 評論 (1) | 編輯 收藏 使用GMail的困惑
用Gmail的時候不小心點了"存檔"按鈕,一封重要的郵件就此消失了好幾天,今天才機緣巧合找到。
在網(wǎng)絡上查到的解釋是: 存檔會將郵件從收件箱移至所有郵件,這樣您不必刪除郵件就可以整理收件箱。 難以理解,坦率地說,這個功能對我來說是徒增煩惱。看來任何工具都需要你去適應,磨合。 posted @ 2011-02-11 11:02 InPractice 閱讀(244) | 評論 (0) | 編輯 收藏 華容道游戲的解決
最近買了一個叫做“華容道”的玩具給兒子晚。這個游戲雖然號稱是中國四大古典智力游戲之一。其實不過百年歷史,而且是從國外引進的。不過本地化做得非常好,也算是創(chuàng)造性地吸收國外文明。
手工解決這個游戲有點難度,當然已經(jīng)有人給出了解法;不過我還是自己用編程的方式解決了一遍。發(fā)現(xiàn)自己在這方面的編程還是比較弱。大部分時間花在了調試上。 剛開始是用的深度優(yōu)先搜索。大致知道了答案應該長什么樣。后來改進為廣度優(yōu)先搜索,得到了最優(yōu)的解法。還有一個就是原先只考慮每次最多移動一格。后來發(fā)現(xiàn)傳統(tǒng)的定義是一個塊的所有連續(xù)移動都算作一步。相應地修改了實現(xiàn)算法。 最難的是做界面。為了調試,隨便寫了個Applet。但是給我兒子玩,就覺得拿不出手了。 posted @ 2010-08-16 13:49 InPractice 閱讀(324) | 評論 (0) | 編輯 收藏 Meta Information
Just use this blog to share some meta information.
git://github.com/ueddieu/mmix.git http://github.com/ueddieu/mmix.git posted @ 2010-06-05 06:44 InPractice 閱讀(191) | 評論 (0) | 編輯 收藏 Notes on Gentoo Installation
After two weeks' struggle, I have successfully installed Gentoo, a popular GNU/Linux Distribution. For Records, the obstacles I encountered are listed below.
(but I can not remember the solution exactly)
0. failed to emerge gpm when I install the links package. If I recall correctly, it is resolved by install gpm manually 1. I encounter issue when I install glib 2.22.5. no update-desktop-database. which is in dev-util/desktop-file-utils. When I try to emerge it, there is a circular dependency on glib. no solution and I forget How I resolve the problem. 2. later after I install glib, with ~amd64 keyword I can install gpm-1.20.6, but it conflicts with the manually inatalled gpm. I remove the conflicted file and emerge successfully. 3. Failed to emerge tiff. edit packages.keywords to add the following. 4. later atk-1.28.0 failed to emerge. edit /etc/make.conf with the following. FEATURES="-stricter". then emerge successfully with only some complain. with out this seting. the warining from GCC will cause that emerge fail. 5. when I run emerge --update system actually gcc will be upgraded from 4.3.4 to 4.4.3. but it failed because of compilation warning, again. add "-stricter" into Features variable in /etc/make.conf work around it. 6. The installation takes a long time, the KDE itself take more than 10 hours. There is still a lot of improvement space! Anyway, it is nice to be able to use it daily. posted @ 2010-06-03 16:33 InPractice 閱讀(338) | 評論 (0) | 編輯 收藏 為SVN客戶端設置Proxy
在C:\Documents and Settings\<user_name>\Application Data\Subversion\servers文件中加入
all=*.* [all] http-proxy-host = ***.**.com http-proxy-port = 8080 這里的all映射到所有的Server。 網(wǎng)絡環(huán)境的復雜給我們的工作帶來了一些影響。就拿Proxy的設置來說,本來理想的情況是在全局做一個設置就可以了,但是事實上我們要為每個程序做設置,而且語法還不一樣。 posted @ 2010-04-21 17:00 InPractice 閱讀(764) | 評論 (0) | 編輯 收藏 小心一些太過智能的工具,比如Word。
今天從word文檔中拷貝腳本到命令行執(zhí)行。沒有想到的是Word自動加入了空格,導致執(zhí)行失敗。具體如下。
call ttGridCreate('$TT_GRID'); 被word變成了 call ttGridCreate(' $TT_GRID'); 這個空格可不容易被發(fā)現(xiàn),尤其你不是腳本作者的時候。提高警惕! posted @ 2010-04-13 16:13 InPractice 閱讀(243) | 評論 (0) | 編輯 收藏 訪問Java對象屬性的性能模型。
今天做了一個簡單的性能測試。比較訪問Java對象屬性的各種方法的性能差異。
1. 直接訪問對象的屬性。 2. 用方法訪問對象的屬性。 3. 用Map來存儲和訪問。 4. 反射-Field 訪問。 5. 反射-Method訪問。 重復100次,結果如下(單位為納秒)。 * 100 field access, 14,806<br/> * 100 method access, 20,393<br/> * 100 map access, 66,489<br/> * 100 reflection field access, 620,190<br/> * 100 reflection method access, 1,832,356<br/> 重復100000次,結果如下(單位為納秒)。 *100000 field access, 2,938,362 *100000 method access, 3,039,772 *100000 map access, 10,784,052 *100000 reflection field access, 144,489,034 *100000 reflection method access, 37,525,719 <br/> 由結果可見: 1。getter/setter 的性能已經(jīng)接近直接屬性訪問(大約慢50%),沒有必要擔心getter/setter的性能而采用直接屬性訪問。 2。用Map代替POJO的代價大約是比getter/setter慢三倍。 3。反射訪問比getter/setter慢50到150倍。慎用。追求動態(tài)性的時候也要注意不菲的性能代價。 4。注意重復次數(shù)增加到100000次,方法訪問和屬性訪問的差距縮小;更有意思的是,反射的Method訪問比Field訪問快四倍。這主要是JIT的作用。 該測試結果和原先的猜想基本符合。但是性能評估很容易得到片面的結論,如果有錯誤的地方,請大家不吝指正。謝謝。 posted @ 2010-04-09 15:57 InPractice 閱讀(338) | 評論 (0) | 編輯 收藏 Tomcat Source Code Reading
0. I am reading the source code of Tomcat 6.0.26. To pay off the effort,
I documents some notes for record. Thanks for the articles about Tomcat source code, especially the book <<How Tomcat works>>. 1. They are two concepts about server, one is called Server, which is for managing the Tomcat (start and stop); another is called Connector, which is the server to serve the application request. they are on the different ports. The server.xml clearly show the difference. <Server port="8005" shutdown="SHUTDOWN"> <Service name="Catalina"> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> although the server is the top level element, logically it should not be. Actually in code, Bootstrap starts the service first, which in turn start the Server and server's services. 2. My focus in on Connector part. I care how the request is services by the Tomcat. Here are some key classes. Connector --> ProtocolHandler (HttpProtocol and AjpProtocol) --> JIoEndPoint --> Handler(Http11ConnectionHandler and AjpConnectionHandler) 3. Connector is most obervious class, but the entry point is not here. The sequence is like this. Connector.Acceptor.run() --> JioEndPoint.processSocke(Socket socket) -->SockeProcess.run() -->Http11ConnectorHandler.process(Socket socket) -->Http11Processor.process(Socket socket) -->CoyoteAdapter.service(Request req, Response res) The core logic is in method Http11Processor.process(Socket socket) CoyoteAdapter.service(Request req, Response res) bridges between Connector module and Container module. Any comments are welcome. I may continue the source code reading and dig deeper into it if time permit. posted @ 2010-03-30 17:11 InPractice 閱讀(607) | 評論 (0) | 編輯 收藏 Navigate forth and back with ctrl+] and ctrl+t in Cscope
It is handy to be able to navigate the source code with Ctrl + ] in Cscope, but I always forget how to navigate back and waste effort many times. So for record, Ctrl+t can navigate back in Cscope.
One more time, Ctrl+] and Ctrl+t can navigate forth and back in Cscope. posted @ 2010-03-29 14:20 InPractice 閱讀(288) | 評論 (0) | 編輯 收藏 Learning Notes of TCP/IP Illustated Volume 2
How to read the source code in <<TCP/IP Illustrated Volume 2>>
1. Get the source code, original link provided in the book is not available now. You may need to google it. 2. install cscope and vi. 3. refer to http://cscope.sourceforge.net/large_projects.html for the following steps. It will include all the source code of the whole OS, not only the kernel. find src -name '*.[ch]' > cscope.files we actually only care kernel source. find src/sys -name '*.[ch]' > cscope.files 4. wc cscope.files 1613 1613 45585 cscope.files 5. vim :help cscope then you can read the help details. 6. if you run vim in the folder where cscope.out resides. then it will be loaded automaically. 7. Try a few commands. :cs find g mbuf :cs find f vm.h They works. A good start. P.S. this book is quite old, if you know it well and can recommend some better alternative for learning TCP/IP, please post a comments, Thanks in advance. posted @ 2010-03-29 13:30 InPractice 閱讀(134) | 評論 (0) | 編輯 收藏 童趣
我兒子在彈鋼琴,他阿姨說,“哥哥就喜歡彈難的。”
我外甥女說:“哥哥要彈男的。妹妹要彈女的。” posted @ 2010-03-26 14:41 InPractice 閱讀(108) | 評論 (0) | 編輯 收藏 幼稚的關于尋找素數(shù)的猜測
在高中的時候,知道了用篩法可以得到素數(shù)。當時我還有一個錯誤的關于尋找素數(shù)的猜測。
以為用兩個素數(shù)相乘,其附近存在素數(shù)的幾率很高。比如, 7×11 = 77, 其附近有79,正好是素數(shù)。 當時已經(jīng)發(fā)現(xiàn)11×11=121。7×17=119;但是錯誤的理解為只有其中一個是平方或次冪時才成立。 后來有了計算機,編程驗證了一下,發(fā)現(xiàn)有很多的反例。對當初的錯誤猜測羞赧不已。 這個猜測雖然錯的離譜,但是和現(xiàn)在的素數(shù)理論,尤其是孿生素數(shù)還是很有關系的。現(xiàn)在已經(jīng)知道, 素數(shù)有無窮多個,但是素數(shù)在自然數(shù)中所占的比例逐漸趨近于零。 因此孿生素數(shù)在自然數(shù)中的比例也是趨近于零的。現(xiàn)在還沒有證明孿生素數(shù)是否有無窮多個。 這個猜測的樸素之處在于,任何兩個素數(shù)之乘積A,要么A是3n+2,要么A是3n+1;如果是3n+2,則只有A+2 才有可能是素數(shù);如果是3n+1,則只有A-2才有可能是素數(shù)。但是,事實上,這個猜測成立的比例非常的低。 寫了一個程序驗證了一下。16位的整數(shù)中,大概只有 10% 能使假設成立。 posted @ 2010-03-26 14:37 InPractice 閱讀(135) | 評論 (0) | 編輯 收藏 在Proxy環(huán)境中使用GIT需要解決的問題.
由于是在Proxy的網(wǎng)絡環(huán)境,MSYSGIT 的 git clone 總是失敗。需要配置如下環(huán)境變量。
export http_proxy="http://<proxy domain name>:<port>" 之后http協(xié)議git clone沒有任何問題。但是用git 協(xié)議仍舊有問題。 之后發(fā)現(xiàn)git push 和 git pull 經(jīng)常不能work。多次嘗試后發(fā)現(xiàn)用更全的命令行參數(shù)可以解決問題。 過程如下。 git pull --fail git pull origin --fail git pull git@github.com:ueddieu/mmix.git --it works. It seems the Command line short cuts are lack of some user information, such as user name "git". (which is kind of strange at the first glance.) git push --fail git push origin --fail git push git@github.com:ueddieu/mmix.git master --it works. Anyway, now I can check in code smoothly. :) posted @ 2009-12-31 17:13 InPractice 閱讀(823) | 評論 (1) | 編輯 收藏 Trouble caused by un-visible blank character
There are a few cases in which the un-visible blank character will cause
problem, but it is hard to detect since they are not visible. One famous case is the '\t' character used by Make file, it is used to mark the start of a command. If it is replace by blank space character, it does not work, but you can not see the difference if you only look at the make file. This kind of problem may get the newbies crazy. Last week, I have encounter a similar issue, which is also caused by unnecessary blank space. As you may know, '\' is used as line-continuation when you have a very long line, e.g. when you configure the class path for Java in a property file, you may have something like this. classpath=/lib/A.jar;/lib/B.jar;\ /lib/C.jar;/lib/D.jar;\ /lib/E.jar;/lib/log4j.jar;\ /lib/F.jar;/lib/httpclient.jar; But if you add extra blank space after the '\', then you can not get the complete content of classpath. Because only when '\' is followed by a '\n' on Unix or '\r''\n' on Windows, it will work as line-continuation ; otherwise, e.g '\' is followed by ' ''\n', the line is complete after the '\n', the content after that will be the start of a new line. Fortunately, it is easy to check this kind of extra blank space by using vi in Unix. use command '$' to go to the end of line, if there is no extra blank space after '\', the current position should be '\', if there are any blank space after '\', the current position is after the '\'. posted @ 2009-07-01 11:48 InPractice 閱讀(177) | 評論 (0) | 編輯 收藏 |
|