Skip site navigation (1) Skip section navigation (2)

Re: Ungraceful handling of fatal flex errors

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Ungraceful handling of fatal flex errors
Date: 2001-01-27 16:15:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> A fatal scanner error (likely a memory exhaustion problem) causes a
> straight exit() without clean up, which causes a system-wide restart.
> This should fix it:

> *** scan.l      2001/01/24 19:43:03     1.85
> --- scan.l      2001/01/27 14:14:29
> ***************
> *** 55,60 ****
> --- 55,62 ----
>   /* No reason to constrain amount of data slurped per myinput() call. */
>   #define YY_READ_BUF_SIZE 16777216

> + #define YY_FATAL_ERROR(msg) elog(FATAL, "%s", (msg))
> +
>   #else /* !FLEX_SCANNER */

>   #undef input

> But you will now get an unavoidable

> scan.c:2145: warning: `yy_fatal_error' defined but not used

I have a sneakier idea to avoid the warning.  The yy_fatal_error routine
is defined as

	(void) fprintf( stderr, "%s\n", msg );

and this is the only use of fprintf in the scan.c file.  How about
leaving yy_fatal_error as the error subroutine, and insert

#define fprintf(file,fmt,msg)  elog(FATAL, "%s", (msg))

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2001-01-27 16:20:52
Subject: Re: wrong query plan in 7.1beta3
Previous:From: Tom LaneDate: 2001-01-27 16:03:10
Subject: Re: plan for running postmaster directly as NT service

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group