我有一台旧的 SUSE 8.1 服务器,最近它开始出现问题。
如果我启动一个程序一次:
/usr/local/jdk1.6.0_21/bin/java -cp example-ser-0.8.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/usr/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/Translator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=logback-test.xml example.ser.Scanner abc12345
将会有 10 个实例运行(同一用户、相同参数),如下所示ps ax -l | grep Scanner
:
FS UID PID PPID C PRI NI 地址 SZ WCHAN TTY 时间 CMD 000 S 502 20228 20227 0 75 0 - 98222 rt_sig pts/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20229 20228 0 75 0 - 98222 调度点/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20230 20229 0 75 0 - 98222 调度点/11 0:14 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20231 20229 0 75 0 - 98222 调度点/11 0:01 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20232 20229 0 76 0 - 98222 rt_sig pts/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20233 20229 0 76 0 - 98222 rt_sig pts/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20234 20229 0 80 0 - 98222 rt_sig pts/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20235 20229 0 75 0 - 98222 rt_sig pts/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20236 20229 0 80 0 - 98222 rt_sig pts/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 002 S 502 20237 20229 0 75 0 - 98222 调度点/11 0:00 /usr/local/jdk1.6.0_21/bin/java -cp /usr/local/lib/java/example-ser-0.7.jar:/usr/local/lib/java/slf4j-api-1.6.1.jar:/usr/local/lib/java/logback-core-0.9.24.jar:/usr/local/lib/java/logback-classic-0.9.24.jar:/usr/local/lib/java/jcl-over-slf4j-1.6.1.jar:/usr/local/lib/java/commons-cli-1.2.jar:/us r/local/lib/java/commons-lang-2.5.jar:/usr/local/lib/java/mysql-connector-java-5.1.13-bin.jar:/usr/local/lib/java/xBaseJ-20091203.jar:/usr/local/lib/java/CampaignRulesTranslator-0.7.0.jar:/usr/local/lib/java/antlr-3.2.jar:/usr/local/lib/java/joda-time-1.6.jar -Dlogback.configurationFile=/usr/local/lib/java/logback.xml example.ser.Scanner abc12345 000 S 0 25155 19094 0 80 0 - 406 pipe_w pts/2 0:00 grep 扫描仪
如果我^C
启动程序的终端,所有 10 个都会消失。此程序不会进行任何分叉或创建任何额外线程。在出现此问题之前,我还尝试过此程序的几个旧版本,它们现在也都遇到了这个问题。这里可能发生了什么?
答案1
程序本身可能不会 fork,但类路径上提供的 libs/jars 可能会 fork,我会首先尝试检查这些 libs 代码是否有 fork。如果失败,请尝试使用不同的 JVM 版本和/或环境执行它,看看会发生什么。