OSX Server Crash on startup (fresh install)

Discussion about topics that don't fit elsewhere.
Post Reply
crontab
Posts: 4
Joined: Fri Dec 26, 2014 3:16 pm

OSX Server Crash on startup (fresh install)

Post by crontab »

My kids have raspberry pi's, was thinking...hmm...would be cool if there was a local server they could connect to whenever they wanted.

Trying to setup OSX Yosemite w/Quartz X, macports lib installs; downloaded 4.5.8a; cp makefile.ox makefile; make; make install...and then...

Code: Select all

$ ./tomenet.server



{R   TomeNET server - v4.5.8
{r   "Tales of Middle Earth"
{w                      http://www.tomenet.net/
{w   http://koti.mbnet.fi/mikaelh/tomenet/

{y Documentation at http://www.tomenet.net/ -> 'The Guide'
[Initializing lua... (scripts)]
26 Dec (Fri) 09:19:11_SERVERSTARTUP_9:19:11-2014/12/26(5)
[Initializing arrays... (features)]
[Initializing arrays... (skills)]
[Initializing arrays... (objects)]
Received signal 11.
ARG!

Is it a lib problem? Not sure.

Code: Select all

otool -L tomenet.server
tomenet.server:
	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1343.16.0)
	/opt/local/lib/libSDL-1.2.0.dylib (compatibility version 12.0.0, current version 12.4.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 21.0.0)
	/opt/X11/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0)
	/opt/local/lib/libncurses.5.dylib (compatibility version 5.0.0, current version 5.0.0)
	/opt/local/lib/libgcrypt.20.dylib (compatibility version 21.0.0, current version 21.2.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
	/opt/local/lib/libSDL_mixer-1.2.0.dylib (compatibility version 13.0.0, current version 13.0.0)
What can I see in debug...

Code: Select all

$ lldb tomenet.server
(lldb) target create "tomenet.server"
Current executable set to 'tomenet.server' (x86_64).
(lldb) run
Process 2131 launched: 'xxxx/Projects/TomeNET/tomenet-4.5.8a/tomenet.server' (x86_64)



{R   TomeNET server - v4.5.8
  
{r   "Tales of Middle Earth"


{w                      http://www.tomenet.net/
{w   http://koti.mbnet.fi/mikaelh/tomenet/


{y Documentation at http://www.tomenet.net/ -> 'The Guide'
[Initializing lua... (scripts)]
26 Dec (Fri) 09:23:18_SERVERSTARTUP_9:23:18-2014/12/26(5)
[Initializing arrays... (features)]
[Initializing arrays... (skills)]
[Initializing arrays... (objects)]
Process 2131 stopped
* thread #1: tid = 0x77cd, 0x00007fff82289387 libsystem_platform.dylib`_platform_memmove$VARIANT$Nehalem + 71, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x102dc3090)
    frame #0: 0x00007fff82289387 libsystem_platform.dylib`_platform_memmove$VARIANT$Nehalem + 71
libsystem_platform.dylib`_platform_memmove$VARIANT$Nehalem + 71:
-> 0x7fff82289387:  movq   %rcx, (%rdi)
   0x7fff8228938a:  addq   $0x8, %rdi
   0x7fff8228938e:  subq   $0x8, %rdx
   0x7fff82289392:  jae    0x7fff82289380            ; _platform_memmove$VARIANT$Nehalem + 64
(lldb) up
frame #1: 0x00007fff82add576 libsystem_c.dylib`stpcpy + 42
libsystem_c.dylib`stpcpy + 42:
-> 0x7fff82add576:  addq   %r14, %rbx
   0x7fff82add579:  movq   %rbx, %rax
   0x7fff82add57c:  addq   $0x8, %rsp
   0x7fff82add580:  popq   %rbx
(lldb) up
frame #2: 0x00007fff82b4ffb7 libsystem_c.dylib`__strcpy_chk + 24
libsystem_c.dylib`__strcpy_chk + 24:
-> 0x7fff82b4ffb7:  subq   %rbx, %rax
   0x7fff82b4ffba:  incq   %rax
   0x7fff82b4ffbd:  cmpq   %r15, %rax
   0x7fff82b4ffc0:  ja     0x7fff82b4ffed            ; __strcpy_chk + 78
(lldb) up
frame #3: 0x0000000100259ae9 tomenet.server`init_k_info_txt(fp=0x00007fff71f811a0, buf=0x00007fff5fbff170) + 1529 at init1.c:2691
   2688				if (!k_ptr->text) k_ptr->text = ++k_head->text_size;
   2689	
   2690				/* Append chars to the name */
-> 2691				strcpy(k_text + k_head->text_size, tmp);
   2692	
   2693				/* Advance the index */
   2694				k_head->text_size += strlen(tmp);
(lldb) up
frame #4: 0x000000010027221b tomenet.server`init_k_info + 571 at init2.c:488
   485 		if (!fp) quit("Cannot open 'k_info.txt' file.");
   486 	
   487 		/* Parse the file */
-> 488 		err = init_k_info_txt(fp, buf);
   489 	
   490 		/* Close it */
   491 		my_fclose(fp);
(lldb) up
frame #5: 0x0000000100271651 tomenet.server`init_some_arrays + 353 at init2.c:3531
   3528	
   3529		/* Initialize object info */
   3530		s_printf("[Initializing arrays... (objects)]\n");
-> 3531		if (init_k_info()) quit("Cannot initialize objects");
   3532	
   3533		/* Initialize artifact info */
   3534		s_printf("[Initializing arrays... (artifacts)]\n");
(lldb) up
frame #6: 0x00000001002a59e4 tomenet.server`main(argc=0, argv=0x00007fff5fbffb10) + 1300 at main.c:402
   399 		init_players();
   400 	
   401 		/* Initialize the arrays */
-> 402 		init_some_arrays();
   403 	
   404 		/* Load dynamic quest data */
   405 		load_quests();
oookaaayy....back down a few frames

Code: Select all

frame #3: 0x0000000100259ae9 tomenet.server`init_k_info_txt(fp=0x00007fff71f811a0, buf=0x00007fff5fbff170) + 1529 at init1.c:2691
   2688				if (!k_ptr->text) k_ptr->text = ++k_head->text_size;
   2689	
   2690				/* Append chars to the name */
-> 2691				strcpy(k_text + k_head->text_size, tmp);
   2692	
   2693				/* Advance the index */
   2694				k_head->text_size += strlen(tmp);
(lldb) print tmp
(char [256]) $1 = " ?wA potion of fresh blood, it will go bad quickly.\n"
(lldb) print k_head->text_size
(u32b) $2 = 11701
(lldb) print k_text
(char *) $3 = 0x0000000102dc02db ""
drats. commenting out the potion of fresh blood, predictably, did not improve results. k_text didn't print out, so I am guessing this isn't so much as a bug in this section of code, but something else smashing k_text. Somewhere between a (unrolling tome src) & b (make install), something is screwed up.

Would any have any recommendations?
crontab
Posts: 4
Joined: Fri Dec 26, 2014 3:16 pm

Re: OSX Server Crash on startup (fresh install)

Post by crontab »

changed from gcc to clang; removed all external dependencies (no SDL, X, etc). deleted ncurses from macport--using default OS X nurses lib.

Code: Select all

$ port installed
The following ports are currently installed:
  expat @2.1.0_0 (active)
  gettext @0.19.4_0 (active)
  libgcrypt @1.6.2_0 (active)
  libgpg-error @1.17_0 (active)
  libiconv @1.14_0 (active)
  ncurses @5.9_2 (active)  *NOT--deleted :/*
then

Code: Select all

$ otool -L tomenet.server
tomenet.server:
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/opt/local/lib/libgcrypt.20.dylib (compatibility version 21.0.0, current version 21.2.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
still blows up.

Tried 4.5.8, 4.5.7b, no dice. *sigh*.

well...lets go back one point release entirely. whoah! 4.4.9c started.

Hmm--maybe its something in 4.5.x? 4.4.9c appeared to build ok. any ideas?
crontab
Posts: 4
Joined: Fri Dec 26, 2014 3:16 pm

Re: OSX Server Crash on startup (fresh install)

Post by crontab »

4.5.6 tomenet.server compiled...guessing it is something related to quests??'

tomenet.server + osx yosemite

4.5.6 - ok
4.5.7 - signal 11 on init
4.5.7a - signal 11 on init
4.5.7b - signal 11 on init
4.5.8 - signal 11 on init
4.5.8a - signal 11 on init
mikaelh
Developer
Posts: 216
Joined: Sun Dec 13, 2009 3:18 pm

Re: OSX Server Crash on startup (fresh install)

Post by mikaelh »

This appears to be a bug in our code. The problem is that we have too many items defined in k_info.txt compared to the value of MAX_K_IDX. This causes the array k_info_num[] to overflow which can overwrite the pointer k_text. That's what seems to have happened in your case.

We're working on a fix. Unfortunately, it's not trivial because MAX_K_IDX is used in nserver.c. I'll let you know once we finish our fix.
mikaelh
Developer
Posts: 216
Joined: Sun Dec 13, 2009 3:18 pm

Re: OSX Server Crash on startup (fresh install)

Post by mikaelh »

Alright, here's our patch for this issue:
http://koti.mbnet.fi/mikaelh/tomenet/do ... -fix.patch

To apply the patch automatically, you can run something like "patch -p1 < tomenet-max_k_idx-crash-fix.patch". Or you can wait for the next release which will include the fix.
Post Reply