Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!munnari.oz.au!goanna!minyos!koel!rcomr From: rcomr@koel.co.rmit.oz (Mark Rawling) Newsgroups: comp.windows.x Subject: Re: Xdbx 2.1 (doesn't work!) Any hints? Message-ID: <5513@minyos.xx.rmit.oz> Date: 31 Aug 90 05:42:09 GMT References: <2413@zgdvda.zgdvda.uucp> Sender: news@minyos.xx.rmit.oz Lines: 63 pfuetz@viktoria.grz (Matthias Pfuetzner) writes: >Starting xdbx produces the following: >.... >it) xdbx opens its window and immediatly closes it again, finishing >its work this way. (Sitting at a BULL DPX1000 also with an MIT X11R3 >server) Fatal server bug: Cannot perform Xalloc (this leading to a >complete hangup of the xserver Xdpx and furthermore producing a core >dump (I haven't analyzed it yet!) >Is there anybody out there having the same problems or having any >hints where the problem wight be (and how it can be patched)? This sounds like it is related to the xdbx bug whereby it suddenly goes into limbo, chewing up memory, swapping out processes, and generally killing your machine until it eventually closes its window and dies with an error something like 'XtMalloc: cannot perform malloc'. Cause and Fix:- There are bugs in the regular expression code used by xdbx (regex.c). Re's of the form \(....\)?, \(....\)+ and \(....\)* are dangerous since (on my machines at least (sun3 and 4)) any reference to a register which has a ?+* on it leads to bogus end addresses for the corresponding register. eg the pattern 'aaaaaxxxxxxaaaaa' matched against .*\(x\)*.* should match and register 1 should start at 5 and end at 10. Instead, it will start at 5 and more than likely end at -2876436460346! xdbx tries to malloc an area as big as `end-start'. The bug is in the reg ex compiler which plants an incorrect 'on failure jump' address for these patterns. There is however an easy work around - simply don't reference registers with repeats, eg in the above example use .*\(\(x\)*\).*, now reg2 is the bogus one but we only want reg1 to get the xxxxx pattern. Thus I use the following pattern for output_pattern[0] (in sun_regex.h) {"\\(.*\n\\)*.*\ \\(\\(stopped\\|Bus error\\|Segmentation fault\\|interrupt\\|signal.*\\|\ Unexpected SIG[^ ]+\\)\ in \\([^ ]+\\) at \\(line \\)?\\([0-9xa-f]+\\)\ \\( in file \"\\([^\"]+\\)\"\\)?\\)\n\ \\(Current function is [^ ]+.*\n\\)?\ \\(.*\n\\)?\ \\(\\(.*\n\\)*\\)", NULL, {2, -1, 4, 6, 8, 11} }, NB: you have to set RE_NREGS to say 15 (ie >=11) in regex.h. (I also changed the max failure stack to 100000 from 20k but am working on a fix which means that xdbx does not match these complex patterns against the entire output string which means the fail stack can be very small.) I have not had a single malloc failure since making these changes. -> Mark ============================================================================ Mark Rawling, CSIRO High Performance Computation Group c/o Royal Melbourne Institute of Technology, email: rcomr@koel.co.rmit.oz{.au} phone: (+ 61 3) 660 2726