2017-09-25 10 views
0

JVM/SSH 충돌로 이어지는 코드는 다음과 같다). 내 코드와 아무 잘못이차단 리눅스는 pthread_create 함수는 내가 ubuntu14.04에는 pthread_create을 차단하려고

Starting namenodes on [ubuntu] 
ubuntu: starting namenode, logging to /home/yangyong/work/hadooptrace/hadoop-2.6.5/logs/hadoop-yangyong-namenode-ubuntu.out 
ubuntu: starting datanode, logging to /home/yangyong/work/hadooptrace/hadoop-2.6.5/logs/hadoop-yangyong-datanode-ubuntu.out 
ubuntu: /home/yangyong/work/hadooptrace/hadoop-2.6.5/sbin/hadoop-daemon.sh: line 131: 7545 Aborted     (core dumped) nohup nice -n 
$HADOOP_NICENESS $hdfsScript --config $HADOOP_CONF_DIR $command "[email protected]" > "$log" 2>&1 < /dev/null 
Starting secondary namenodes [0.0.0.0 
# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# SIGSEGV (0xb) at pc=0x0000000000000000, pid=7585, tid=140445258151680 
# 
# JRE version: OpenJDK Runtime Environment (7.0_121) (build 1.7.0_121-b00) 
# Java VM: OpenJDK 64-Bit Server VM (24.121-b00 mixed mode linux-amd64 compressed oops) 
# Derivative: IcedTea 2.6.8 
# Distribution: Ubuntu 14.04 LTS, package 7u121-2.6.8-1ubuntu0.14.04.1 
# Problematic frame: 
# C 0x0000000000000000 
# 
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again 
# 
# An error report file with more information is saved as: 
# /home/yangyong/work/hadooptrace/hadoop-2.6.5/hs_err_pid7585.log 
# 
# If you would like to submit a bug report, please include 
# instructions on how to reproduce the bug and visit: 
# http://icedtea.classpath.org/bugzilla 
#] 
A: ssh: Could not resolve hostname a: Name or service not known 
#: ssh: Could not resolve hostname #: Name or service not known 
fatal: ssh: Could not resolve hostname fatal: Name or service not known 
been: ssh: Could not resolve hostname been: Name or service not known 
#: ssh: Could not resolve hostname #: Name or service not known 
#: ssh: Could not resolve hostname #: Name or service not known 
#: ssh: Could not resolve hostname #: Name or service not known 
^COpenJDK: ssh: Could not resolve hostname openjdk: Name or service not known 
detected: ssh: Could not resolve hostname detected: Name or service not known 
version:: ssh: Could not resolve hostname version:: Name or service not known 
JRE: ssh: Could not resolve hostname jre: Name or service not known 

있습니까 : 나는 JVM에서 Hadoop을 함께 사용하는 경우, 그것은 나에게 이런 오류 보고서를했다? 아니면 JVM이나 SSH의 보호 메커니즘과 같은 다른 이유 때문입니까? 감사합니다.

+0

다른 유사한 오류 예가 있습니다 : [link] (https://sourceware.org/ml/glibc-linux/2001-q1/msg00048.html) – Chalex

답변

0

이 코드는 잘못된 arg 값을 갖도록 자식 스레드가 발생합니다

struct thread_param temp; 
    temp.args=arg; 
    temp.start_routine=start_routine; 

    int result=old_create(thread,attr,intermedia,(void *)&temp); 
//  int result=old_create(thread,attr,start_routine,arg); 
    return result; // <-- temp and its contents are now invalid 

temp 값을 무효화 돌아왔다 수 있습니다 귀하의 pthread_create()에 부모 호출로 새로운 스레드에서 더 이상 존재 보장 할 수 없습니다 포함되어 있습니다.

+0

고마워요! 이 문제를 해결합니다! – Chalex

0

코드에 많은 문제가 있습니다. 어떤 문제 (있는 경우)가 문제를 일으키는 지 알 수는 없지만 확실히 수정해야합니다.

먼저 코어 덤프 (보통 ulimit -c unlimited을 사용)를 켜고 GDB에서 코어를로드 할 수 있습니다. 백 트레이스가 가리키는 부분을 확인하십시오.

Do not dlopen pthreads. 대신 dlsym(RTLD_NEXT, "pthread_create")을 사용할 수 있어야합니다.

그러나 문제의 원인은 원래 변수를 전역 변수에 저장한다는 것입니다. 즉, 누군가 (예 : 자바 런타임)가 동시에 많은 스레드를 여는 경우, 무엇을 할 것인가를 혼동하게됩니다.

+0

답장을 보내 주셔서 감사합니다. 첫 번째 요점은 gdb 디버깅에 익숙하지 않고 이후에 사용하도록 설정했지만 여전히 문제를 파악할 수는 없습니다. 두 번째 사항은 dlsym (RTLD_NEXT, "pthread_create")을 사용하면 경고 메시지가 표시되고 jvm은 여전히 ​​중단됩니다. 세 번째 요점은 어떤 변수가 전역 변수인지 확실하지 않습니다. 어쨌든 귀하의 신속한 응답에 감사드립니다. – Chalex