Subject: bug#6604: 23.2; Crashes in GC on MS-Windows

From: Eli Zaretskii <[email-masked]>
Date: Sat, 10 Jul 2010 18:52:09 +0300

Emacs 23.2 started crashing on me a few days ago.  So far it crashed
twice in a couple of days.  Both times the crash is inside GC, at the
same place.  I attach one such backtrace below; it is not a GDB
backtrace because I wasn't running under GDB at the time.

I have no built a non-optimized binary and run it under GDB, so I
could debug it when it crashes.  But if someone sees similar crashes,
please post the data.

Here's the backtrace:

emacs.exe caused an Access Violation at location 010682ef in module emacs.exe Reading from location ac0003e4.

Registers:
eax=00000150 ebx=ac000150 ecx=0000002a edx=ac000000 esi=0000007c edi=00000001
eip=010682ef esp=0082cb10 ebp=0082cc48 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202

Call stack:
010682EF  emacs.exe:010682EF  Fgarbage_collect  alloc.c:5941

	...
	int this_free = 0;
	for (i = 0; i < lim; i++)
>	  if (!FLOAT_MARKED_P (&fblk->floats[i]))
	    {
	      this_free++;
	...

0100C3CB  emacs.exe:0100C3CB  Ffuncall  eval.c:2958

	...
	      ||
	      (!NILP (Vmemory_full) && consing_since_gc > memory_full_cons_threshold))
>	    Fgarbage_collect ();
	
	  if (++lisp_eval_depth > max_lisp_eval_depth)
	...

0100A249  emacs.exe:0100A249  internal_condition_case_2  eval.c:1590

	...
	
	  val = (*bfun) (nargs, args);
>	  catchlist = c.next;
	  handlerlist = h.next;
	  return val;
	...

01013933  emacs.exe:01013933  safe_call  xdisp.c:2387

	...
	       safe_eval_handler);
	      UNGCPRO;
>	      val = unbind_to (count, val);
	    }
	
	...

0101396E  emacs.exe:0101396E  safe_call1  xdisp.c:2405

	...
	  args[1] = arg;
	  return safe_call (2, args);
>	}
	
	static Lisp_Object Qeval;
	...

0101398A  emacs.exe:0101398A  safe_eval  xdisp.c:2413

	...
	{
	  return safe_call1 (Qeval, sexpr);
>	}
	
	/* Call function FN with one argument ARG.
	...

0102A5E1  emacs.exe:0102A5E1  display_mode_element  xdisp.c:17666

	...
	Lisp_Object spec;
	spec = safe_eval (XCAR (XCDR (elt)));
>	n += display_mode_element (it, depth, field_width - n,
	   precision - n, spec, props,
	   risky);
	...

0102A79B  emacs.exe:0102A79B  display_mode_element  xdisp.c:17755

	...
	   props, risky);
	elt = XCDR (elt);
>	len++;
	if ((len & 1) == 0)
	  halftail = XCDR (halftail);
	...

0102A79B  emacs.exe:0102A79B  display_mode_element  xdisp.c:17755

	...
	   props, risky);
	elt = XCDR (elt);
>	len++;
	if ((len & 1) == 0)
	  halftail = XCDR (halftail);
	...

0102B89D  emacs.exe:0102B89D  display_mode_line  xdisp.c:17258

	...
	  record_unwind_save_match_data ();
	  display_mode_element (&it, 0, 0, 0, format, Qnil, 0);
>	  pop_kboard ();
	
	  unbind_to (count, Qnil);
	...

0102BA94  emacs.exe:0102BA94  display_mode_lines  xdisp.c:17201

	...
	
	      /* Select mode line face based on the real selected window.  */
>	      display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w),
	 current_buffer->mode_line_format);
	      ++n;
	...

0102D059  emacs.exe:0102D059  redisplay_window  xdisp.c:13832

	...
	      /* If mode line height has changed, arrange for a thorough
	 immediate redisplay using the correct mode line height.  */
>	      if (WINDOW_WANTS_MODELINE_P (w)
	  && CURRENT_MODE_LINE_HEIGHT (w) != DESIRED_MODE_LINE_HEIGHT (w))
	{
	...

0102E937  emacs.exe:0102E937  redisplay_window_0  xdisp.c:12239

	...
	  if (displayed_buffer->display_error_modiff < BUF_MODIFF (displayed_buffer))
	    redisplay_window (window, 0);
>	  return Qnil;
	}
	
	...

01009ED5  emacs.exe:01009ED5  internal_condition_case_1  eval.c:1539

	...
	
	  val = (*bfun) (arg);
>	  catchlist = c.next;
	  handlerlist = h.next;
	  return val;
	...

0101E049  emacs.exe:0101E049  redisplay_windows  xdisp.c:12217

	...
	  /* Use list_of_error, not Qerror, so that
	     we catch only errors and don't run the debugger.  */
>	  internal_condition_case_1 (redisplay_window_0, window,
	     list_of_error,
	     redisplay_window_error);
	...

0101E006  emacs.exe:0101E006  redisplay_windows  xdisp.c:12211

	...
	redisplay_windows (w->hchild);
	      else if (!NILP (w->vchild))
>	redisplay_windows (w->vchild);
	      else if (!NILP (w->buffer))
	{
	...

01030678  emacs.exe:01030678  redisplay_internal  xdisp.c:11789

	...
	
	      if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
>	redisplay_windows (FRAME_ROOT_WINDOW (f));
	
	      /* The X error handler may have deleted that frame.  */
	...

01030E68  emacs.exe:01030E68  redisplay_preserve_echo_area  xdisp.c:12038

	...
	      display_last_displayed_message_p = 1;
	      redisplay_internal (1);
>	      display_last_displayed_message_p = 0;
	    }
	  else
	...

0109E9B9  emacs.exe:0109E9B9  Fredisplay  dispnew.c:6684

	...
	    specbind (Qredisplay_dont_pause, Qt);
	  redisplay_preserve_echo_area (2);
>	  unbind_to (count, Qnil);
	  return Qt;
	}
	...

0100C617  emacs.exe:0100C617  Ffuncall  eval.c:3024

	...
	  goto done;
	case 1:
>	  val = (*XSUBR (fun)->function) (internal_args[0]);
	  goto done;
	case 2:
	...

0111E156  emacs.exe:0111E156  Fbyte_code  bytecode.c:680

	...
	      }
	#endif
>	    TOP = Ffuncall (op + 1, &TOP);
	    AFTER_POTENTIAL_GC ();
	    break;
	...

0100C012  emacs.exe:0100C012  funcall_lambda  eval.c:3216

	...
	    }
	
>	  return unbind_to (count, val);
	}
	
	...

0100C3F6  emacs.exe:0100C3F6  Ffuncall  eval.c:3093

	...
	 done:
	  CHECK_CONS_LIST ();
>	  lisp_eval_depth--;
	  if (backtrace.debug_on_exit)
	    val = call_debugger (Fcons (Qexit, Fcons (val, Qnil)));
	...

0111E156  emacs.exe:0111E156  Fbyte_code  bytecode.c:680

	...
	      }
	#endif
>	    TOP = Ffuncall (op + 1, &TOP);
	    AFTER_POTENTIAL_GC ();
	    break;
	...

0100C012  emacs.exe:0100C012  funcall_lambda  eval.c:3216

	...
	    }
	
>	  return unbind_to (count, val);
	}
	
	...

0100C3F6  emacs.exe:0100C3F6  Ffuncall  eval.c:3093

	...
	 done:
	  CHECK_CONS_LIST ();
>	  lisp_eval_depth--;
	  if (backtrace.debug_on_exit)
	    val = call_debugger (Fcons (Qexit, Fcons (val, Qnil)));
	...

0100CE1D  emacs.exe:0100CE1D  Fapply  eval.c:2504

	...
	  /* By convention, the caller needs to gcpro Ffuncall's args.  */
	  RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args));
>	}
	
	/* Run hook variables in various ways.  */
	...

0100C6B4  emacs.exe:0100C6B4  Ffuncall  eval.c:3005

	...
	      if (XSUBR (fun)->max_args == MANY)
	{
>	  val = (*XSUBR (fun)->function) (numargs, args + 1);
	  goto done;
	}
	...

0111E156  emacs.exe:0111E156  Fbyte_code  bytecode.c:680

	...
	      }
	#endif
>	    TOP = Ffuncall (op + 1, &TOP);
	    AFTER_POTENTIAL_GC ();
	    break;
	...

0100BBE5  emacs.exe:0100BBE5  Feval  eval.c:2352

	...
	  goto done;
	case 3:
>	  val = (*XSUBR (fun)->function) (argvals[0], argvals[1],
	  argvals[2]);
	  goto done;
	...

0100D667  emacs.exe:0100D667  internal_lisp_condition_case  eval.c:1435

	...
	  handlerlist = &h;
	
>	  val = Feval (bodyform);
	  catchlist = c.next;
	  handlerlist = h.next;
	...

0111E96B  emacs.exe:0111E96B  Fbyte_code  bytecode.c:870

	...
	    body = POP;
	    BEFORE_POTENTIAL_GC ();
>	    TOP = internal_lisp_condition_case (TOP, body, handlers);
	    AFTER_POTENTIAL_GC ();
	    break;
	...

0100C012  emacs.exe:0100C012  funcall_lambda  eval.c:3216

	...
	    }
	
>	  return unbind_to (count, val);
	}
	
	...

0100C3F6  emacs.exe:0100C3F6  Ffuncall  eval.c:3093

	...
	 done:
	  CHECK_CONS_LIST ();
>	  lisp_eval_depth--;
	  if (backtrace.debug_on_exit)
	    val = call_debugger (Fcons (Qexit, Fcons (val, Qnil)));
	...

0100CA19  emacs.exe:0100CA19  call1  eval.c:2811

	...
	  RETURN_UNGCPRO (Ffuncall (2, &fn));
	#endif /* not NO_ARG_ARRAY */
>	}
	
	/* Call function fn with 2 arguments arg1, arg2 */
	...

010552BF  emacs.exe:010552BF  timer_check  keyboard.c:4713

	...
	
	      call1 (Qtimer_event_handler, chosen_timer);
>	      Vdeactivate_mark = old_deactivate_mark;
	      timers_run++;
	      unbind_to (count, Qnil);
	...

010553D8  emacs.exe:010553D8  readable_events  keyboard.c:3698

	...
	
	  if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
>	    timer_check (1);
	
	  /* If the buffer contains only FOCUS_IN_EVENT events, and
	...

0105ABDB  emacs.exe:0105ABDB  get_input_pending  keyboard.c:7038

	...
	{
	  /* First of all, have we already counted some input?  */
>	  *addr = (!NILP (Vquit_flag) || readable_events (flags));
	
	  /* If input is being read as it arrives, and we have none, there is none.  */
	...

0105AC8B  emacs.exe:0105AC8B  detect_input_pending_run_timers  keyboard.c:10707

	...
	
	  if (!input_pending)
>	    get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW);
	
	  if (old_timers_run != timers_run && do_display)
	...

01046756  emacs.exe:01046756  wait_reading_process_output  process.c:5022

	...
	  int leave = 0;
	
>	  if (detect_input_pending_run_timers (do_display))
	    {
	      swallow_events (do_display);
	...

0105C35F  emacs.exe:0105C35F  read_char  keyboard.c:4137

	...
	wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
	
>	      if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
	/* Pass 1 for EXPECT since we just waited to have input.  */
	read_avail_input (1);
	...

0105E242  emacs.exe:0105E242  read_key_sequence  keyboard.c:9515

	...
	     (Lisp_Object *) submaps, last_nonmenu_event,
	     &used_mouse_menu, NULL);
>	    if ((INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */
	/* When switching to a new tty (with a new keyboard),
	   read_char returns the new buffer, rather than -2
	...

01060287  emacs.exe:01060287  command_loop_1  keyboard.c:1643

	...
	
	      /* Read next key sequence; i gets its length.  */
>	      i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0],
	     Qnil, 0, 1, 1);
	
	...

0100A16A  emacs.exe:0100A16A  internal_condition_case  eval.c:1491

	...
	
	  val = (*bfun) ();
>	  catchlist = c.next;
	  handlerlist = h.next;
	  return val;
	...

0105381A  emacs.exe:0105381A  command_loop_2  keyboard.c:1360

	...
	
	  do
>	    val = internal_condition_case (command_loop_1, Qerror, cmd_error);
	  while (!NILP (val));
	
	...

0100A09F  emacs.exe:0100A09F  internal_catch  eval.c:1226

	...
	  /* Call FUNC.  */
	  if (! _setjmp (c.jmp))
>	    c.val = (*func) (arg);
	
	  /* Throw works by a longjmp that comes right here.  */
	...

01053627  emacs.exe:01053627  command_loop  keyboard.c:1343

	...
	
	/* End of file in -batch run causes exit here.  */
>	if (noninteractive)
	  Fkill_emacs (Qt);
	      }
	...

010536C0  emacs.exe:010536C0  recursive_edit_1  keyboard.c:955

	...
	
	  val = command_loop ();
>	  if (EQ (val, Qt))
	    Fsignal (Qquit, Qnil);
	  /* Handle throw from read_minibuf when using minibuffer
	...

010537E1  emacs.exe:010537E1  Frecursive_edit  keyboard.c:1017

	...
	
	  recursive_edit_1 ();
>	  return unbind_to (count, Qnil);
	}
	
	...

01002E2F  emacs.exe:01002E2F  main  emacs.c:1836

	...
	  /* NOTREACHED */
	  return 0;
>	}
	
	/* Sort the args so we can find the most important ones
	...

0100124B  emacs.exe:0100124B
01001298  emacs.exe:01001298
7C816D4F  kernel32.dll:7C816D4F  RegisterWaitForInputIdle

In GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600)
 of 2010-07-10 on HOME-C4E4A596F7
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1255
  default enable-multibyte-characters: t

Major mode: Mail

Minor modes in effect:
  flyspell-mode: t
  desktop-save-mode: t
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  line-number-mode: t
  abbrev-mode: t

Recent input:
y y C-x b I N <tab> <return> <C-next> <C-next> <C-next> 
<C-next> <C-next> <C-next> <C-next> <C-next> <C-next> 
<C-next> <C-next> <C-next> <C-prior> <C-prior> <M-end> 
C-x b * M e s <tab> <return> <prior> C-x k <return> 
C-x 5 b * i <tab> 1 > <return> <switch-frame> C-x 5 
b x d <tab> <return> C-x C-f C-g <switch-frame> <help-echo> 
M-1 g <M-backspace> d a t <tab> m a i l . n e w <return> 
d d SPC d d d d d d d C-x C-s r <switch-frame> <switch-frame> 
<help-echo> M-~ <help-echo> <help-echo> <help-echo> 
<switch-frame> <switch-frame> <switch-frame> C-x C-f 
d : / u s <tab> <M-backspace> g n <tab> e m a <tab> 
- 2 3 <tab> <tab> x <tab> e m <tab> 2 / s r <tab> <M-backspace> 
e m <tab> <M-backspace> <M-backspace> <M-backspace> 
<backspace> _ c <tab> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <M-backspace> <M-backspace> b z <tab> e 
m <tab> e m <tab> e m <tab> . t <tab> <return> C-x 
4 f <up> <left> <left> <left> <left> 2 <return> <M-home> 
<down> <down> <down> <up> <up> <down> <down> <down> 
<down> <down> <down> <down> <M-home> <down> <down> 
<down> <down> <down> <down> <down> <down> M-x c o m 
p a <tab> <return> C-x b I N B <tab> - <tab> <return> 
<C-next> <C-next> <C-next> <C-next> <C-next> <C-next> 
<C-next> <C-next> <C-next> <M-end> C-x b I N <tab> 
<return> m e m a c s - d e v e l SPC <backspace> <down> 
E m a c s SPC 2 3 . 2 SPC c r a s h e s SPC i n SPC 
G C <down> <down> <down> <down> <down> <down> M-x r 
e p o r t - e m <tab> <return>

Recent messages:
Wrote d:/usr/eli/rmail/INBOX
Computing summary lines...done
9 new messages read
No following nondeleted message
Saving file d:/usr/eli/rmail/INBOX...
Wrote d:/usr/eli/rmail/INBOX
Parsing d:/usr/eli/.mailrc... done
Modification-flag cleared
Making completion list...
Mark set

Load-path shadows:
None found.

Features:
(shadow emacsbug compare-w help-mode view mailalias mailabbrev
sendmail conf-mode newcomment ld-script sh-script executable dired-x
dired-aux dired tcl generic parse-time nxml-uchnm rng-xsd xsd-regexp
rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse
rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln
nxml-rap nxml-util nxml-glyph nxml-enc xmltok sgml-mode arc-mode
archive-mode python-21 python gud comint ring vc-cvs make-mode org-wl
org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs
org-html org-exp org-exp-blocks org-agenda org-info org-gnus
org-bibtex org-bbdb org byte-opt bytecomp byte-compile advice help-fns
advice-preload org-footnote org-src org-list org-faces org-compat
org-macs time-date noutline outline easy-mmode jka-compr cc-mode
cc-fonts cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
regexp-opt info easymenu vc-bzr sha1 hex-util flyspell ispell add-log
rmailsum rmail mail-utils desktop server filecache saveplace generic-x
paren battery time tooltip ediff-hook vc-hooks lisp-float-type mwheel
dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev loaddefs button minibuffer faces
cus-face files text-properties overlay md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process multi-tty emacs)