libxml2 문제...??

hyper9의 이미지

libxml2 와 관련된 문제로 보이는 현상때문에..
계속 헛짓을 하다 질문을 올려봅니다..

일단 어떤 현상이냐하면요,,

printf("Debug message #1\n");
xmlFree( Buffer );
printf("Debug message #2\n");

와 같은 code에서 첫번째 debug message를 찍고 두번째 debug message는 찍지 못하는
문제 입니다.

처음에는 잘 몰랐는데,,나중에 좀 조사를 해보니 xmlFree()라는 function자체는
libxml2 라는 package에 딸려있는 것 같아 보였고요 ..

지금설치되어 있는 관련 rpm Package는
libxml2-2.6.28-2와
libxml2-python-2.6.28-2
두 가지 입니다.

그런데 이 문제를 재현해 보려고 3가지 System에서 Code를 수행해 봤습니다.
첫번째는 Single Core Pentium 4 2.80GHz CPU에서 수행했는데
두번째 debug message까지 잘 찍습니다.
두번째로는 Hyper Threading이 지원되는 두 개의 Xeon Processor (3.0GHz)가
설치되어 있는 System에서 수행을 해봤습니다..역시 두번째 debug message까지
잘 찍습니다..
세번째로는 두 개의 QuadCore Processor 거 설치되어 있는 System에서 해봤는데
여기서는 위에서 말씀드린대로 계속 error가 나는지 두번째 debug message를 찍을 수
없네요..

혹시나 해서 Kernel의 Hyper Threading option을 끄고 QuadCore System에서
다시 수행을 했는데 역시 같은 결과를 보여주면서 안되었고요.

이번에는 SMP option마저 끄고 다시 한번 해봤는데,,계속 안되네요..
어떻게 접근을 해보는 것이 좋을지,,의견을 부탁드리고 싶습니다.
미리 감사드립니다. ^^

hyper9의 이미지

한가지 더 질문은요..

libxml2에 thread safety에 대한 option을 설정할 수
있거나,,비슷한게 있나요??

keizie의 이미지

http://xmlsoft.org/threads.html

--with-threads을 써서 컴파일했는지 확인하고, xmlInitParser()를 최초에 호출했는지 확인하라고 하네요.

hyper9의 이미지

그런데,,저의 경우는 Fedora 7에서 제공되었던 libxml2 rpm file을 install해서
쓰고 있는 경우인데요 ..

이런 경우에 --with-threads option을 썼는지 아닌지는 어떻게 확인할 수 있을까요?
그리고,,만일 새로 --with-threads option을 써서 새로 compile 해야 한다면
source를 구해서 따로 build해서 설치해야 하는 거겠죠?

답변 감사합니다..

keizie의 이미지

.spec 파일이 포함되어 있을 건데, 거기에 컴파일 옵션이 적혀 있습니다.
짐작컨데 쓰레드 옵션이 이미 포함되어 있을 거라 생각합니다.

init 함수를 빼먹지 않으셨는지요?

hyper9의 이미지

이런 ...

.spec file이 어디에 있는지를 모르겠네요..어떻게 찾아야 할까요?
그리고 말씀하신 init함수라는 것이 위에서 언급하셨던 xmlInitParser()
라는 function을 말씀하시는 건가요?

너무 모르고 있어서 질문이 많아지네요...
다시 감사드립니다.

hyper9의 이미지

에고 위에서 말씀하셨던 .spec file이라는 것이
libxml2.spec이나 libxml.spec 같은건가요?
이런 file이 없는 것 같아서요 ..

다른 file이면 다시 알려주시면 감사하겠습니다.

keizie의 이미지

libxml2로 검색한 다음 fc7 srpm을 받으니 그 안에 libxml2.spec 파일이 있네요.

hyper9의 이미지

전 Fedora7을 설치한 PC안에도 찾아도 없고,
또 배포판 CD안엘 찾아도 없던데요..

Internet 검색을 하신 거에요?

hyper9의 이미지

말씀하셨던 init funtion이 xmlInitParser()가 맞다면요,,

이걸 어디에서 실행시키는게 적당할까요?
libxml2의 library function들을 가져다쓰는 Thread에서
Thread가 시작할 때쯤 어디에 넣어놓으면 될까요?

너무 잘 모르다보니,,질문내용도 좀 그러네요 ㅜㅜ

hyper9의 이미지

말씀해 주신 libxml2.spec file을 통째로 올렸습니당 ㅜㅜ
그런데 --with-threads option을 어디에 주는지는 계속 못 찾고 있는데요..
한번 더 도움을 주실 수 있으신지요

Summary: Library providing XML and HTML support
Name: libxml2
Version: 2.6.31
Release: 1%{?dist}%{?extra_release}
License: MIT
Group: Development/Libraries
Source: ftp://xmlsoft.org/libxml2-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: python python-devel zlib-devel
URL: http://xmlsoft.org/
Prefix: %{_prefix}
Docdir: %{_docdir}
Patch0: multilib.patch

%description
This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
to select subnodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.

%package devel
Summary: Libraries, includes, etc. to develop XML and HTML applications
Group: Development/Libraries
Requires: libxml2 = %{version}
Requires: zlib-devel
Requires: pkgconfig

%description devel
Libraries, include files, etc you can use to develop XML applications.
This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DtDs, either
at parse time or later once the document has been modified. The output
can be a simple SAX stream or and in-memory DOM like representations.
In this case one can use the built-in XPath and XPointer implementation
to select subnodes or ranges. A flexible Input/Output mechanism is
available, with existing HTTP and FTP modules and combined to an
URI library.

%package python
Summary: Python bindings for the libxml2 library
Group: Development/Libraries
Requires: libxml2 = %{version}

%description python
The libxml2-python package contains a module that permits applications
written in the Python programming language to use the interface
supplied by the libxml2 library to manipulate XML files.

This library allows to manipulate XML files. It includes support
to read, modify and write XML and HTML files. There is DTDs support
this includes parsing and validation even with complex DTDs, either
at parse time or later once the document has been modified.

%prep
%setup -q
%patch0 -p1

%build
%configure
make
gzip -9 ChangeLog

%install
rm -fr %{buildroot}

%makeinstall
(cd doc/examples ; make clean ; rm -rf .deps)
gzip -9 doc/libxml2-api.xml
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la

%clean
rm -fr %{buildroot}

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%files
%defattr(-, root, root)

%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO
%doc %{_mandir}/man1/xmllint.1*
%doc %{_mandir}/man1/xmlcatalog.1*
%doc %{_mandir}/man3/libxml.3*

%{_libdir}/lib*.so.*
%{prefix}/bin/xmllint
%{prefix}/bin/xmlcatalog

%files devel
%defattr(-, root, root)

%doc %{_mandir}/man1/xml2-config.1*
%doc AUTHORS ChangeLog.gz NEWS README Copyright TODO
%doc doc/*.html doc/html doc/*.gif doc/*.png
%doc doc/tutorial doc/libxml2-api.xml.gz
%doc doc/examples
%doc %dir %{_datadir}/gtk-doc/html/libxml2
%doc %{_datadir}/gtk-doc/html/libxml2/*.devhelp
%doc %{_datadir}/gtk-doc/html/libxml2/*.html
%doc %{_datadir}/gtk-doc/html/libxml2/*.png
%doc %{_datadir}/gtk-doc/html/libxml2/*.css

%{_libdir}/lib*.so
%{_libdir}/*a
%{_libdir}/*.sh
%{prefix}/include/*
%{prefix}/bin/xml2-config
%{prefix}/share/aclocal/libxml.m4
%{_libdir}/pkgconfig/libxml-2.0.pc
%files python
%defattr(-, root, root)

%doc AUTHORS ChangeLog.gz NEWS README Copyright
%{_libdir}/python*/site-packages/libxml2.py*
%{_libdir}/python*/site-packages/drv_libxml2.py*
%{_libdir}/python*/site-packages/libxml2mod*
%doc python/TODO
%doc python/libxml2class.txt
%doc python/tests/*.py
%doc doc/*.py
%doc doc/python.html

%changelog
* Fri Jan 11 2008 Daniel Veillard 2.6.31-1.f7
- upstream release 2.6.31 see http://xmlsoft.org/news.html
- many bug fixed upstream

* Tue Jun 12 2007 Daniel Veillard 2.6.29-1.f7
- upstream release 2.6.29 see http://xmlsoft.org/news.html
- many bug fixed upstream

* Wed May 16 2007 Matthias Clasen 2.6.28-2
- Bump revision to fix N-V-R problem

* Tue Apr 17 2007 Daniel Veillard 2.6.28-1
- upstream release 2.6.28 see http://xmlsoft.org/news.html
- many bug fixed upstream

* Thu Dec 7 2006 Jeremy Katz - 2.6.27-2
- rebuild against python 2.5

* Wed Oct 25 2006 Daniel Veillard 2.6.27-1
- upstream release 2.6.27 see http://xmlsoft.org/news.html
- very large amount of bug fixes reported upstream

* Wed Jul 12 2006 Jesse Keating - 2.6.26-2.1.1
- rebuild

* Wed Jul 12 2006 Jesse Keating - 2.6.26-2.1
- rebuild

* Wed Jun 7 2006 Daniel Veillard 2.6.26-2
- fix bug #192873
* Tue Jun 6 2006 Daniel Veillard 2.6.26-1
- upstream release 2.6.26 see http://xmlsoft.org/news.html

* Tue Jun 6 2006 Daniel Veillard
- upstream release 2.6.25 broken, do not ship !

hyper9의 이미지

당장 해보고 ..결과를 update할게요 ^^

hyper9의 이미지

처음에는 아래와 같이 하라는 거라고 생각하고 ..
rpmbuild --without pgsql --nodeps -bb php.spec
rpmbuild --with pgsql=no --nodeps -bb php.spec
rpmbuild --with-pgsql=no --nodeps -bb php.spec
rpmbuild --without pgsql --nodeps -bb php.spec

저는
rpmbuild --with-threads -ba libxml2.spec --target=i386
으로 했더니..

--with-threads: unknown option이라고 나오네요 .

그래서 다시 링크해 주신 내용을 자세히 보니..위와 같이 하지말고

Use

$ rpmbuild --rcfile sanspgsql.rc ...
$ rpmbuild --rcfile withpgsql.rc ...

You can set macros in the rcfile that the spec file will then obey.

이렇게 하라는 건가봐요 ..
그런데,,그럼 rcfile을 어떻게 만드는지, 또 어떤 macro를 설정하라는건지에서
다시 막혀 버렸답니다..
에고,,조언 주실 수 있으시면 좋겠네요..

hyper9의 이미지

이번에는 제목과 같이 해봤는데요 ..

Compile과정에 나오는 다음장면을 보면,,

+ ./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info

제대로 --with-threads option이 설정되지 않은 것 같네요..
좀더 들여다 볼 예정입니다. ㅜㅜ

hyper9의 이미지

--with-threads를 사용해서 compile을 다시했고요,
xmlInitParser()는 main()에 추가를 했답니다.

하지만 문제가 계속 똑같이 발생을 하네요 ..
혹시 더 해볼만한 Idea가 없을까요?

벌써 1주일째 이 문제로 고민 중이라 답답하네요 ㅜㅜ

hyper9의 이미지

혹시 QuadCore CPU를 사용하시면서 libxml2의 문제를 겪으신 분 있으시면
부탁합니다.
잘 안되니까,,별별 생각이 많이 드네요 ~

hyper9의 이미지

libxml2의 문제가 아니고 HW문제거나 또는 Linux Configuration문제는
아닌지에 대한 걱정도 좀 생기네요..

혹시 이와 관련해서 확인해 볼 수 있는 방법은 없을까요?

hyper9의 이미지

(gdb) next
950 xmlFree( Buffer );
(gdb) stepi
0x0809b11a 950 xmlFree( Buffer );
(gdb) stepi
0x0809b11d 950 xmlFree( Buffer );
(gdb) stepi
0xb7b0d5a0 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5a1 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5a3 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5a6 in free () from /lib/libc.so.6
(gdb) si

0xb7b0d5a9 in free () from /lib/libc.so.6
(gdb) si
0xb7ab6db0 in __i686.get_pc_thunk.bx () from /lib/libc.so.6
(gdb) si
0xb7ab6db3 in __i686.get_pc_thunk.bx () from /lib/libc.so.6
(gdb) si
0xb7b0d5ae in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5b4 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5b7 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5ba in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5bd in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5c3 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5c5 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5c7 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5e2 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5e4 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5e6 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5e9 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5ec in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5ef in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5f1 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5f3 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5f5 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5fb in free () from /lib/libc.so.6
(gdb) si
0xb7b0d5fd in free () from /lib/libc.so.6
(gdb) si
0xb7b0d604 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d607 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d609 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d60b in free () from /lib/libc.so.6
(gdb) si
0xb7b0d610 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d618 in free () from /lib/libc.so.6
(gdb) si
0xb7b0d61a in free () from /lib/libc.so.6
(gdb) si
0xb7b0d61e in free () from /lib/libc.so.6
(gdb) si
0xb7b0e377 in _L_lock_14919 () from /lib/libc.so.6
(gdb) si
0xb7b0e379 in _L_lock_14919 () from /lib/libc.so.6
(gdb) si
0xb7b809e0 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809e1 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809e2 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809e3 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809e8 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809ea in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809ec in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809ee in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f0 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f9 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809fb in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809fd in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809ff in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f2 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f7 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si

0xb7b809f9 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809fb in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809fd in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809ff in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f2 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f7 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f9 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809fb in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809fd in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809ff in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f2 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f7 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809f9 in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb) si
0xb7b809fb in __lll_mutex_lock_wait () from /lib/libc.so.6
(gdb)

계속 이렇게 반복 되네요..뭔가 힌트가 없을까요? ~

hyper9의 이미지

한다고 하긴 했는데,,
이게 제대로 thread safe하게 compile되긴 한건지
자신이 없어지네요..
이런 걸 확인할 수 있는 방법이 있을까요? ~

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.