Visit The New, Modern Unix Linux Community


Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3


 
Thread Tools Search this Thread
Top Forums Programming Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3
# 1  
Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3

Hello there,

My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64.

It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386).

The current machine has 2x Core 2 Duo (Xenon) processors and 8GB of RAM.

Here are few backtraces from GDB:

Code:
(gdb) bt
#0  0x00000008014b08bc in thr_kill () from /lib/libc.so.7
#1  0x000000080153fa2b in abort () from /lib/libc.so.7
#2  0x00000008010a6614 in __gnu_cxx::__verbose_terminate_handler ()
   from /usr/lib/libstdc++.so.6
#3  0x00000008010aab23 in std::set_unexpected () from /usr/lib/libstdc++.so.6
#4  0x00000008010aab63 in std::terminate () from /usr/lib/libstdc++.so.6
#5  0x00000008010aaaca in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0x00000008010fb109 in operator new () from /usr/lib/libstdc++.so.6
#7  0x00000008010abf21 in std::string::_Rep::_S_create ()
   from /usr/lib/libstdc++.so.6
#8  0x00000008010ad291 in std::string::_M_mutate ()
   from /usr/lib/libstdc++.so.6
#9  0x00000000005af174 in filtrate (stream=
        {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x80694e4d8 "samsung321"}}, numbers=true, letters=true, spaces=false)
    at basic_string.h:1360
#10 0x0000000000517f0c in loginGameWorld (msg=
      {m_MsgSize = 0, m_ReadPos = 4, version = 822, m_outputBufferStart = 4, sending = 0, receiving = 0, m_MsgBuf = "\205\000\n\002\0006\003\000;j?D\200\221˛\n4\222đmS&.\000ę*\004\000\006\000Thozen\n\000samsung321Ľ\005z,Ż<řŻp\2216G?żGĄ\205ĎU>\001AłA\223\b0Ćře\034@\213ַą\200®dşˇĽˇ\225Ř^(˙\020˘ř,Ď\004\236---Type <return> to continue, or q <return> to quit---
\001\003;iŢj3\022\234ş$:IŞmxF", '\0' <repeats 130417 times>, "\003\000\000\000\000\000\000\000xɱ\037\000\000\000\000\016\000\000\000\000\000\000\000p", '\0' <repeats 23 times>, "\001\000\000\000\000\000\000\000\bőL\001\b\000\000\000\003\000\000\000"..., m_encryptionEnabled = true, m_checksumEnabled = true, m_keyset = true, m_key = {1145006651, 179474816, 1844482612, 774263802}, m_RSA = 0x801b1f100}, s=11, clientip=3585481299) at basic_string.h:426
#11 0x0000000000550d72 in ConnectionHandler (dat=0xb)
    at /root/ronots/otserv.cpp:161
#12 0x0000000800f1ea27 in pthread_getprio () from /lib/libthr.so.3
#13 0x00007ffffe9f7000 in ?? ()
Error accessing memory address 0x7ffffebf7000: Bad address.

Code:
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x801c0e600 (LWP 100154)]
0x00000008014b08bc in thr_kill () from /lib/libc.so.7
(gdb) bt
#0  0x00000008014b08bc in thr_kill () from /lib/libc.so.7
#1  0x000000080153fa2b in abort () from /lib/libc.so.7
#2  0x00000008010a6614 in __gnu_cxx::__verbose_terminate_handler ()
   from /usr/lib/libstdc++.so.6
#3  0x00000008010aab23 in std::set_unexpected () from /usr/lib/libstdc++.so.6
#4  0x00000008010aab63 in std::terminate () from /usr/lib/libstdc++.so.6
#5  0x00000008010aaaca in __cxa_throw () from /usr/lib/libstdc++.so.6
#6  0x00000008010fb109 in operator new () from /usr/lib/libstdc++.so.6
#7  0x00000000004ae353 in std::_Rb_tree<Tile*, std::pair<Tile* const, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, CreatureState> > > >, std::_Select1st<std::pair<Tile* const, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, CreatureState> > > > >, std::less<Tile*>, std::allocator<std::pair<Tile* const, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, CreatureState> > > > > >::_M_insert (this=0x7fffff59a5c0, __x=0x0, __p=0x806949d80, 
    __v=@0x7fffff599dc0) at new_allocator.h:81
#8  0x00000000004ae732 in std::_Rb_tree<Tile*, std::pair<Tile* const, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, CreatureState> > > >, std::_Select1st<std::pair<Tile* const, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, CreatureState> > > > >, std::less<Tile*>, std::allocator<std::pair<Tile* const, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, Creature---Type <return> to continue, or q <return> to quit---
State> > > > > >::insert_unique (this=0x7fffff59a5c0, __position=
      {_M_node = 0x806949580}, __v=@0x7fffff599dc0) at stl_tree.h:923
#9  0x00000000004ae8ec in std::map<Tile*, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, CreatureState> > >, std::less<Tile*>, std::allocator<std::pair<Tile* const, std::vector<std::pair<Creature*, CreatureState>, std::allocator<std::pair<Creature*, CreatureState> > > > > >::operator[] (this=0x7fffff59a5c0, __k=@0x7fffff599e98) at stl_map.h:384
#10 0x00000000004a3d64 in GameState::onAttack (this=0x7fffff59a5a0, 
    attacker=0x8069ac000, pos=@0x7fffff59a5f0, me=0x7fffff59a850, temp=169, 
    stackpos=0) at stl_vector.h:314
#11 0x000000000048cf3d in Game::creatureMakeMagic (this=0x1fb19de0, 
    creature=0x8069ac000, centerpos=@0x7fffff59a840, me=0x7fffff59a850, 
    stackpos=0) at stl_iterator.h:614
#12 0x00000000004904c3 in Game::creatureCastSpell (this=0x1fb19de0, 
    creature=0x8069ac000, centerpos=@0x7fffff59a840, me=@0x7fffff59a850)
    at /root/ronots/game.cpp:7825
#13 0x00000000005a68f2 in SpellScript::luaActionDoAreaSpell (L=0x801b10840)
    at /root/ronots/spells.cpp:695
#14 0x0000000800a4379b in luaD_precall () from /usr/local/lib/liblua-5.0.so.0
#15 0x0000000800a4cd8e in luaV_execute () from /usr/local/lib/liblua-5.0.so.0
#16 0x0000000800a43bf4 in luaD_call () from /usr/local/lib/liblua-5.0.so.0
#17 0x0000000800a433b7 in luaD_rawrunprotected ()
---Type <return> to continue, or q <return> to quit---
   from /usr/local/lib/liblua-5.0.so.0
#18 0x0000000800a434e5 in luaD_pcall () from /usr/local/lib/liblua-5.0.so.0
#19 0x0000000800a3fe13 in lua_pcall () from /usr/local/lib/liblua-5.0.so.0
#20 0x000000000059f4e7 in SpellScript::castSpell (this=0x801be3550, 
    creature=0x8069ac000, pos=@0x8069ac020, var=
        {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x80699c268 "exevo gran mas frigo"}}) at /root/ronots/spells.cpp:419
#21 0x000000000046200b in Game::creatureSaySpell (this=0x801d08040, 
    creature=0x8069ac000, text=@0x7fffff59b270) at spells.h:176
#22 0x0000000000591b55 in Protocol80::parseSay (this=0x806a22000, 
    msg=@0x7fffff59b660) at /root/ronots/protocol80.cpp:1976
#23 0x0000000000594f0b in Protocol80::parsePacket (this=0x806a22000, 
    msg=@0x7fffff59b660) at /root/ronots/protocol80.cpp:544
#24 0x0000000000595892 in Protocol80::ReceiveLoop (this=0x806a22000)
    at /root/ronots/protocol80.cpp:317
#25 0x000000000051aeec in loginGameWorld (msg=
      {m_MsgSize = 7368304, m_ReadPos = 0, version = 110435352, m_outputBufferStart = 8, sending = 110435352, receiving = 8, m_MsgBuf = "\031\034\225\006\b\000\000\000\030\034\225\006\b\000\000\0002\034\225\006\b\000\000\000\030\036\225\006\b\000\000\000\200g\"\001\b\000\000\000\030\000\000\000\000\000\000\000\030\034\225\006\b\000\000\000px \001\b\000\000\000\006", '\0' <repeats 15 times>, "---Type <return> to continue, or q <return> to quit---
\002\020", '\0' <repeats 166 times>, "\b\000\000\000\000\000\000\000\bş[˙˙\177\000\000\200g\"\001\b", '\0' <repeats 19 times>, "xą[˙˙\177\000\000Ŕi\"\001\b\000\000\000Pl\"\001\b\000\000\000@l\"\001\b\000\000\000řmp", '\0' <repeats 13 times>, " np\000\000\000\000\000đkp\000\000\000\000\000\030\030\225\006\b\000\000\000\030\030\225\006\b\000\000\000\030\030\225\006\b"..., m_encryptionEnabled = false, m_checksumEnabled = false, m_keyset = false, m_key = {0, 0, 0, 0}, m_RSA = 0x0}, s=-10766488, clientip=70706064) at /root/ronots/login.cpp:906
#26 0x0000000000550d72 in ConnectionHandler (dat=0x9)
    at /root/ronots/otserv.cpp:161
#27 0x0000000800f1ea27 in pthread_getprio () from /lib/libthr.so.3
#28 0x00007fffff3fc000 in ?? ()
Error accessing memory address 0x7fffff5fc000: Bad address.

Code:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x8057cf300 (LWP 100127)]
0x00000008014cf959 in free () from /lib/libc.so.7
(gdb) bt
#0  0x00000008014cf959 in free () from /lib/libc.so.7
#1  0x000000000056fc92 in Player::log (this=0x806806000, text=
        {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x80680c2f8 "asd asdadasd asd askdj alsdj alskd jalksd jlasdjla"}}, 
    sender=0x806867058, receiver=0x39, spell=128, broadcast=false, 
    command=false, channel=
        {static npos = 18446744073709551615, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x7068c8 ""}}) at /root/ronots/player.cpp:393
#2  0x000000000044d4bd in Game::creatureSay (this=0x7fffff99ccb0, 
    creature=0x806806000, type=SPEAK_SAY, text=@0x7fffff99d270, 
    text2=@0x806802e98, spell=false) at new_allocator.h:62
#3  0x000000000059239f in Protocol80::parseSay (this=0x80680d000, msg=@0x0)
    at /root/ronots/protocol80.cpp:2023
#4  0x0000000000594f0b in Protocol80::parsePacket (this=0x80680d000, 
    msg=@0x7fffff99d660) at /root/ronots/protocol80.cpp:544
#5  0x0000000000595892 in Protocol80::ReceiveLoop (this=0x80680d000)
    at /root/ronots/protocol80.cpp:317
#6  0x000000000051aeec in loginGameWorld (msg=
      {m_MsgSize = 7368304, m_ReadPos = 0, version = 109374488, m_outputBufferStart = 8, sending = 109374488, receiving = 8, m_MsgBuf = "\031ě\204\006\b\000\0---Type <return> to continue, or q <return> to
---Type <return> to continue, or q <return> to quit---
00\000\030ě\204\006\b\000\000\0002ě\204\006\b\000\000\000\030\204\006\b\000\000\000\200g\"\001\b\000\000\000\030\000\000\000\000\000\000\000\030ě\204\006\b\000\000\000px \001\b\000\000\000\006", '\0' <repeats 15 times>, "\002\020", '\0' <repeats 166 times>, "\b\000\000\000\000\000\000\000\b\233˙˙\177\000\000\200g\"\001\b", '\0' <repeats 19 times>, "xŮ\233˙˙\177\000\000Ŕi\"\001\b\000\000\000Pl\"\001\b\000\000\000@l\"\001\b\000\000\000řmp", '\0' <repeats 13 times>, " np\000\000\000\000\000đkp\000\000\000\000\000\030č\204\006\b\000\000\000\030č\204\006\b\000\000\000\030č\204\006\b"..., m_encryptionEnabled = false, m_checksumEnabled = false, m_keyset = false, m_key = {17769376, 8, 942681648, 32565}, m_RSA = 0x8010e4db6}, s=-6563992, clientip=70693776) at /root/ronots/login.cpp:906
#7  0x0000000000550d72 in ConnectionHandler (dat=0x9)
    at /root/ronots/otserv.cpp:161
#8  0x0000000800f1ea27 in pthread_getprio () from /lib/libthr.so.3
#9  0x00007fffff7fe000 in ?? ()
Error accessing memory address 0x7fffff9fe000: Bad address.

The application uses these additional libraries:
- Lua 5.0.2
- Boost 1.34.1 or higher
- mysqlclient
- xml2
- GMP

So the line for the compiler libraries is:
-lxml2 -llua -llualib -lboost_regex -lgmp -ldl -lmysqlclient -lpthread

The most common crash reason is 'std::bad_alloc' appearing in libstdc++.so.6 while trying to insert_unique a new element, but crashes are indeed accidentals and they appear in all over the code, when using libc, libstdc++ libraries.

I was working on it for 2 days and I already ran out of ideas.

I tried to get rid of these crashes in few ways:

- By increasing the maximum memory consumption for the single process from 512MB to ~2GB, my application uses 1.5GB of memory at start.

Code:
$ limits
Resource limits (current):
  cputime          infinity secs
  filesize         infinity kB
  datasize          2025139 kB
  stacksize         2025603 kB
  coredumpsize     infinity kB
  memoryuse        infinity kB
  memorylocked     infinity kB
  maxprocesses         5547
  openfiles           11095
  sbsize           infinity bytes
  vmemoryuse       infinity kB

- By compiling the code using g++ 3.4, 4.1, 4.2, 4.3, 4.4 (as far as I know it uses another version of libstdc++, libc libraries).
- By upgrading boost library to version 1.37.
- By compiling the kernel with options SCHED_4BSD instead of standard SCHED_ULE.
- By checking the code for presence of casting 64bits pointers to 32bits variables (like casting *int to int for example) "truncated pointers error".

Can you please give me some hints? I would really appreciate some help and advice.

Best regards,
S.
# 2  
Ok, the problem is solved. It was not FreeBSD's fault but mine - wrong use of delete operator caused these crashes. In FreeBSD 6.3 it was crashing only once per few hours, in FreeBSD 7.1 the crash was occuring after application start.

Thank you for your time anyway.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #514
Difficulty: Easy
As a general rule, the more a variable is used, the longer the variable name should be.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

motif application crashes while calling XtDestroyWidget

Hi All, We have a 32bit Motif Gui application. Now we ported the application from Solaris to Linux and the system is crashing very frequently. On our analysis we could find that this issue happened when we are closing the forms in our application. When the forms are closed we will delete the forms... (0 Replies)
Discussion started by: sanushchacko
0 Replies

2. Fedora

FreeBSD

I'm using Windows mostly and the only *nix thing I used during my life was cygwin (I like command line :)). But currently I have (by an occasion) a DVD with latest FreeBSD. I don't know why, but I want to install it... But probably, this OS is too difficult for a beginner. I heard, it's used on... (3 Replies)
Discussion started by: TeenageWerewolf
3 Replies

3. Solaris

application Crashes on memset ?? any suggestions

Hi All, we have an application that is written in 'C' programming to connects to various servers in the organization. The bellow code establish a TCP connection to connect to the remote servers. the application works perfectly ok, but, after some time the entire process get's crashed and... (2 Replies)
Discussion started by: sudharma
2 Replies

4. BSD

please help me in FreeBSD

Hi to all, Iam doing a project in Free BSD and i am stuck with a puzzle. Please any one of you clarify my doubt : How to add a mechanism to check the status of the file system which alerts the root user via. email if any single partition is greater than 90% full. This alert should include the... (3 Replies)
Discussion started by: tadakamalla
3 Replies

5. UNIX for Dummies Questions & Answers

Freebsd and win 2000 working 2gether?

Hi Brothers, Please, I've just purchased a new PC and I would like to have both win 2000 and freebsd in the same hard drive, ( 40GB and 128Mb ) can you please help how to set up my new hard drive , please! Thank you..... aka Polymorphous (2 Replies)
Discussion started by: Polymorphous
2 Replies

6. BSD

I want the Best FREEBSD

B]I want the best of the best FreeBSD version for my study in Unix...please sugest me... Thanks (5 Replies)
Discussion started by: israel
5 Replies

7. UNIX for Dummies Questions & Answers

FreeBSD

What is FreeBSD, who does use Free? (3 Replies)
Discussion started by: cyberangel
3 Replies

8. UNIX for Dummies Questions & Answers

Freebsd 4.5

i am new at unix and am VERY confused about the compression processes. what progs do i need to unzip and zip files? there must be a standard one similar to winzip? (1 Reply)
Discussion started by: Mindscan
1 Replies

9. UNIX for Dummies Questions & Answers

FreeBSD

I am on AOL now,and i am using 56 k,i was gonna install FreeBSD,but i dont know if aol works on BSD,or my modem. Do they work on BSD? (2 Replies)
Discussion started by: kita
2 Replies

10. UNIX for Dummies Questions & Answers

need help with FreeBSD!!!

Hi I want to write to my output_file using: if((fptr = creat(output_file, _S_IWRITE)) == -1) { printf("output_file..."..); return (1); } for(...) { _write(fptr, buffer, BUF_SIZE); } It says "_S_IWRITE" undeclared!!! Anybody knows what function I can use for that and what I... (3 Replies)
Discussion started by: lacasa
3 Replies

Featured Tech Videos