Re: WIP Incremental JSON Parser

From: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: WIP Incremental JSON Parser
Date: 2024-02-21 20:26:51
Message-ID: CAOYmi+mZER=D1gEDOt7Td8tB214eHFbViYvDvEjF4uiJ3bFv=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 21, 2024 at 6:50 AM Jacob Champion
<jacob(dot)champion(at)enterprisedb(dot)com> wrote:
> On Tue, Feb 20, 2024 at 9:32 PM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> > *sigh* That's weird. I wonder why you can reproduce it and I can't. Can
> > you give me details of the build? OS, compiler, path to source, build
> > setup etc.? Anything that might be remotely relevant.

This construction seems suspect, in json_lex_number():

> if (lex->incremental && !lex->inc_state->is_last_chunk &&
> len >= lex->input_length)
> {
> appendStringInfoString(&lex->inc_state->partial_token,
> lex->token_start);
> return JSON_INCOMPLETE;
> }

appendStringInfoString() isn't respecting the end of the chunk: if
there's extra data after the chunk boundary (as
AppendIncrementalManifestData() does) then all of that will be stuck
onto the end of the partial_token.

I'm about to context-switch off of this for the day, but I can work on
a patch tomorrow if that'd be helpful. It looks like this is not the
only call to appendStringInfoString().

--Jacob

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-02-21 21:10:10 Re: margay fails assertion in stats/dsa/dsm code
Previous Message Jeff Davis 2024-02-21 20:24:42 Re: LogwrtResult contended spinlock