unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@lsi.nec.co.jp>
Cc: bob@rattlesnake.com
Subject: signal handling bogosities
Date: 19 Dec 2002 19:15:46 +0900	[thread overview]
Message-ID: <buok7i62u25.fsf_-_@mcspd15.ucom.lsi.nec.co.jp> (raw)
In-Reply-To: <m18Of88-000IeAC@localhost>

I've got another core dump from my face-realization-filter code
(see attached backtrace), and seeing it raises some more fundamental
questions about the redisplay code.

Basically the problem seem to be that it's evaluating lisp code in a
place where it shouldn't, though I'm not sure I understand all the rules
for exactly where is OK and where is not.

The point of failure is this, in `Feval' (eval.c, line 1983):

  if (handling_signal)
    abort ();

it _is_ in a signal handler, specifically:

   #16 0x080dc6f2 in input_available_signal (signo=29)
       at /usr/local/src/emacs/src/keyboard.c:6633

That signal results in `note_mouse_movement', and then
`note_mouse_highlight' being called:

   #11 0x080b2345 in note_mouse_highlight (f=0x850aa18, x=184, y=260)
       at /usr/local/src/emacs/src/xterm.c:7407
   #12 0x080b162e in note_mouse_movement (frame=0x850aa18, event=0xbffd1064)
       at /usr/local/src/emacs/src/xterm.c:6893
   #13 0x080b5f05 in handle_one_xevent (dpyinfo=0x84f5490, eventp=0xbffd13ac, 
       bufp_r=0xbffd1418, numcharsp=0xbffd141c, finish=0xbffd13a8)
       at /usr/local/src/emacs/src/xterm.c:11291

note_mouse_highlight then tries to figure out the proper mouse-face-id,
which calls face realization, and if realize-face-filter-functions has
a non-nil value, calls the lisp interpreter, and thus dies as seen.

Now, I suppose that calling the lisp interpreter inside a signal handler
might be a bad thing, and so perhaps the check in Feval is reasonable
(though the byte-code evaluator _doesn't_ seem to check; perhaps if I
compiled my code, it would work :-).

What concerns me is that even without that, it seems to be doing an
absurd amount of stuff inside the the signal handler, to the extent that
it seems very hard to be sure _what_ code will end being called.  After
it does the face lookup that killed me, it seems to go and actually
display the mouse face, and in other branches of the code the whole
redisplay engine seems to be invoked, for exposure events (I don't know
whether that can result in lisp code being called, but it seems as if it
could -- given the complexity of redisplay, it's kind of hard to tell).

So what do people think?  The whole thing seems really broken to me, but
I don't have a complete grasp of the code.  How hard would be to
restructure things to just queue this stuff for an event-loop outside
the signal handler to handle?

Thanks,

-Miles



Here's the full backtrace:


#0  0x402eac51 in kill () from /lib/libc.so.6
#1  0x080d377a in abort () at /usr/local/src/emacs/src/emacs.c:412
#2  0x0812b44a in Feval (form=1481199500)
    at /usr/local/src/emacs/src/eval.c:1984
#3  0x081292b2 in Fprogn (args=1481198692)
    at /usr/local/src/emacs/src/eval.c:424
#4  0x0812c586 in funcall_lambda (fun=1481198684, nargs=1, 
    arg_vector=0xbffd0b08) at /usr/local/src/emacs/src/eval.c:2921
#5  0x0812c1b1 in Ffuncall (nargs=2, args=0xbffd0b04)
    at /usr/local/src/emacs/src/eval.c:2798
#6  0x0812a880 in internal_condition_case_2 (bfun=0x812bebc <Ffuncall>, 
    nargs=2, args=0xbffd0b04, handlers=405463828, 
    hfun=0x805cd10 <safe_eval_handler>) at /usr/local/src/emacs/src/eval.c:1435
#7  0x0805ce03 in safe_call (nargs=2, args=0xbffd0b04)
    at /usr/local/src/emacs/src/xdisp.c:1400
#8  0x0805ce38 in safe_call1 (fn=408560044, arg=1220621664)
    at /usr/local/src/emacs/src/xdisp.c:1420
#9  0x080a2a9e in realize_face (cache=0x850f090, attrs=0xbffd0c68, c=0, 
    base_face=0x0, former_face_id=-1) at /usr/local/src/emacs/src/xfaces.c:6723
#10 0x080a3b95 in face_at_buffer_position (w=0x8cf3e78, pos=1983, 
    region_beg=0, region_end=0, endptr=0xbffd0d6c, limit=1984, mouse=1)
    at /usr/local/src/emacs/src/xfaces.c:5648
#11 0x080b2345 in note_mouse_highlight (f=0x850aa18, x=184, y=260)
    at /usr/local/src/emacs/src/xterm.c:7407
#12 0x080b162e in note_mouse_movement (frame=0x850aa18, event=0xbffd1064)
    at /usr/local/src/emacs/src/xterm.c:6893
#13 0x080b5f05 in handle_one_xevent (dpyinfo=0x84f5490, eventp=0xbffd13ac, 
    bufp_r=0xbffd1418, numcharsp=0xbffd141c, finish=0xbffd13a8)
    at /usr/local/src/emacs/src/xterm.c:11291
#14 0x080b654d in XTread_socket (sd=0, bufp=0xbffd244c, numchars=4096, 
    expected=1) at /usr/local/src/emacs/src/xterm.c:11719
#15 0x080dc531 in read_avail_input (expected=1)
    at /usr/local/src/emacs/src/keyboard.c:6470
#16 0x080dc6f2 in input_available_signal (signo=29)
    at /usr/local/src/emacs/src/keyboard.c:6633
#17 0x402eabd8 in sigaction () from /lib/libc.so.6
#18 0x08057271 in sit_for (sec=30, usec=0, reading=1, display=1, 
    initial_display=0) at /usr/local/src/emacs/src/dispnew.c:6247
#19 0x080d8305 in read_char (commandflag=1, nmaps=2, maps=0xbfffeb60, 
    prev_event=405463780, used_mouse_menu=0xbfffebac)
    at /usr/local/src/emacs/src/keyboard.c:2635
#20 0x080de7a0 in read_key_sequence (keybuf=0xbfffecb0, bufsize=30, 
    prompt=405463780, dont_downcase_last=0, can_return_switch_frame=1, 
    fix_current_buffer=1) at /usr/local/src/emacs/src/keyboard.c:8398
#21 0x080d63f8 in command_loop_1 () at /usr/local/src/emacs/src/keyboard.c:1478
#22 0x0812a689 in internal_condition_case (bfun=0x80d60f0 <command_loop_1>, 
    handlers=405560436, hfun=0x80d5d04 <cmd_error>)
    at /usr/local/src/emacs/src/eval.c:1352
#23 0x080d5fc8 in command_loop_2 () at /usr/local/src/emacs/src/keyboard.c:1279
#24 0x0812a21d in internal_catch (tag=405521716, 
    func=0x80d5fa4 <command_loop_2>, arg=405463780)
    at /usr/local/src/emacs/src/eval.c:1112
#25 0x080d5f73 in command_loop () at /usr/local/src/emacs/src/keyboard.c:1258
#26 0x080d5ac0 in recursive_edit_1 ()
    at /usr/local/src/emacs/src/keyboard.c:974
#27 0x080d5bf0 in Frecursive_edit ()
    at /usr/local/src/emacs/src/keyboard.c:1030
#28 0x080d4a83 in main (argc=3, argv=0xbffff274)
    at /usr/local/src/emacs/src/emacs.c:1659

-- 
Yo mama's so fat when she gets on an elevator it HAS to go down.

  reply	other threads:[~2002-12-19 10:15 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-07 19:39 Gtk version getting closer Jan D.
2002-11-08  0:08 ` Kim F. Storm
2002-11-08  9:21   ` jasonr
2002-11-08  9:56     ` Juanma Barranquero
2002-11-08 11:25       ` Kim F. Storm
2002-11-08 10:36         ` Juanma Barranquero
2002-11-09 14:27         ` Jan D.
2002-11-09 21:29   ` Eli Zaretskii
2002-11-09 11:53 ` Richard Stallman
2002-11-09 14:16   ` Jan D.
2002-11-11 10:19     ` Richard Stallman
2002-11-09 15:05   ` Karl Eichwalder
2002-11-11 10:19     ` Richard Stallman
2002-11-11 18:36       ` Karl Eichwalder
2002-11-12  5:50         ` Eli Zaretskii
2002-11-12  7:24           ` Karl Eichwalder
2002-11-12 17:15             ` Eli Zaretskii
2002-11-13  4:40             ` Miles Bader
2002-11-13  5:42               ` Eli Zaretskii
2002-11-13 13:21                 ` Robert J. Chassell
2002-11-13 15:38                   ` Jan D.
2002-11-13 16:35                     ` Stefan Monnier
2002-11-13 17:58                       ` Jan D.
2002-11-14 18:57                     ` Eli Zaretskii
2002-11-14 20:07                       ` Jan D.
2002-11-14 20:28                         ` Eli Zaretskii
2002-11-14 23:03                       ` Jason Rumney
2002-11-15 15:59                         ` Eli Zaretskii
2002-11-13 15:55                   ` Kim F. Storm
2002-11-13 18:23                     ` Robert J. Chassell
2002-11-13 18:42                       ` Stefan Monnier
2002-11-13 21:15                         ` Jan D.
2002-11-13 18:58                       ` David Masterson
2002-11-13 16:52                   ` Francesco Potorti`
2002-11-14 12:16                   ` Richard Stallman
2002-11-14 16:46                     ` Robert J. Chassell
2002-11-15  2:20                       ` Miles Bader
2002-11-15 12:29                         ` Robert J. Chassell
     [not found]                         ` <m18EUbO-000IeAC@localhost>
2002-11-20 22:08                           ` Bold by moving pixels problem Miles Bader
2002-11-21  0:21                             ` Robert J. Chassell
2002-11-21  1:33                               ` Stefan Monnier
2002-11-21  1:44                                 ` Miles Bader
     [not found]                                   ` <m18HRR2-000IeBC@localhost>
2002-12-17  5:00                                     ` Miles Bader
2002-12-17  6:28                                       ` Miles Bader
2002-12-17  7:08                                         ` Miles Bader
2002-12-18 10:01                                           ` Miles Bader
2002-12-18 12:26                                             ` Kim F. Storm
2002-12-19  8:34                                               ` Miles Bader
2002-12-19 10:18                                                 ` Miles Bader
2002-12-19 12:18                                                 ` Kim F. Storm
2002-12-19 11:27                                                   ` Miles Bader
2002-12-19 12:25                                                     ` Miles Bader
2002-12-19 13:55                                                       ` Kim F. Storm
2003-01-07 11:02                                                       ` Kim F. Storm
2003-01-07 14:02                                                         ` Miles Bader
2003-01-09  7:28                                                         ` Richard Stallman
2003-01-09  7:52                                                           ` Miles Bader
2002-12-18 14:25                                             ` Robert J. Chassell
2002-12-19 10:15                                               ` Miles Bader [this message]
2002-12-20 17:12                                                 ` signal handling bogosities Richard Stallman
2002-12-20 17:46                                                   ` Eli Zaretskii
2002-12-20 18:35                                                   ` Alex Schroeder
2002-12-20 22:06                                                   ` Miles Bader
2002-12-21 20:26                                                     ` Richard Stallman
2002-12-21 23:42                                                       ` Alex Schroeder
2002-12-23 20:58                                                         ` Richard Stallman
2002-12-22  2:02                                                       ` Miles Bader
2002-12-22  2:27                                                   ` Miles Bader
2002-12-23 20:58                                                     ` Richard Stallman
2002-12-17 10:31                                       ` Bold by moving pixels problem Kim F. Storm
2002-12-17 16:38                                       ` Robert J. Chassell
2002-12-17 23:54                                         ` Miles Bader
2002-11-21  6:01                               ` Eli Zaretskii
2002-11-16  1:34                       ` Gtk version getting closer Richard Stallman
2002-11-14 12:16               ` Richard Stallman
2002-11-12 12:34           ` Jan D.
2002-11-12 17:21             ` Eli Zaretskii
2002-11-13 10:15               ` Jan D.
2002-11-14 12:16                 ` Richard Stallman
2002-11-14 18:53                 ` Eli Zaretskii
2002-11-14 20:13                   ` Jan D.
2002-11-13 16:55             ` Jason Rumney
2002-11-14 17:25               ` Jan D.
2002-11-14  4:09             ` Richard Stallman
2002-11-14 17:49               ` Jan D.
2002-11-14 20:29                 ` Eli Zaretskii
2002-11-14 21:47                   ` Jan D.
2002-11-14 21:30                 ` David Masterson
2002-11-16  1:34                 ` Richard Stallman
2002-11-16 16:11                   ` Jan D.
2002-11-13 11:32         ` Richard Stallman
2002-11-13 17:09         ` David Masterson
2002-11-14 17:31           ` Jan D.
2002-11-14 20:22             ` David Masterson
2002-11-16  1:34               ` Richard Stallman
2002-11-18  5:06                 ` David Masterson
2002-11-15  2:36           ` Richard Stallman
2002-11-15  4:04             ` Miles Bader
2002-11-15 16:36               ` David Masterson
2002-11-15 16:31                 ` Eli Zaretskii
2002-11-15 18:46                   ` David Masterson
2002-11-15 21:15                     ` Eli Zaretskii
2002-11-15 22:35                       ` David Masterson
2002-11-15 17:33                 ` Miles Bader
2002-11-15 18:55                   ` David Masterson
2002-11-15 23:18                     ` Jason Rumney
2002-11-16  0:44                       ` David Masterson
2002-11-15 19:03                   ` Stefan Monnier
2002-11-15 18:00                 ` Robert J. Chassell
2002-11-19 13:26                   ` Miles Bader
2002-11-20 21:13                   ` Richard Stallman
2002-11-20 21:56                     ` Jason Rumney
2002-11-21  0:47                       ` Robert J. Chassell
2002-11-22 21:00                         ` Richard Stallman
2002-11-21  0:38                     ` Robert J. Chassell
2002-11-21 13:09                       ` Kenichi Handa
2002-11-21 14:08                         ` Miles Bader
2002-11-21 21:47                           ` Jason Rumney
2002-11-15 18:13                 ` Jason Rumney
2002-11-15 19:03                   ` David Masterson
2002-11-09 21:31 ` Eli Zaretskii
2002-11-10  9:02   ` Jan D.
2002-11-11 10:20     ` Richard Stallman
     [not found] <buo3cou2qxx.fsf@mcspd15.ucom.lsi.nec.co.jp>
2002-12-19 14:04 ` signal handling bogosities Gerd Moellmann
2002-12-20  1:44   ` Miles Bader
2002-12-20 10:25     ` Gerd Moellmann
2002-12-20 11:40       ` Kim F. Storm
2002-12-20 11:29         ` Gerd Moellmann
2002-12-25 11:52       ` Michael Livshin
2002-12-26  7:49         ` Richard Stallman
2002-12-31 16:54           ` Jan D.
2003-01-02 18:38             ` Richard Stallman
2003-01-04 12:33               ` Jan D.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=buok7i62u25.fsf_-_@mcspd15.ucom.lsi.nec.co.jp \
    --to=miles@lsi.nec.co.jp \
    --cc=bob@rattlesnake.com \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).