avro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Douglas Creager (JIRA)" <j...@apache.org>
Subject [jira] Commented: (AVRO-741) C: examples/quickstep segfaults
Date Mon, 24 Jan 2011 15:41:44 GMT

    [ https://issues.apache.org/jira/browse/AVRO-741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12985739#action_12985739

Douglas Creager commented on AVRO-741:

I wouldn't just revert the commit — that would mean that the buffer used to store the bytes
value wouldn't go through the custom allocator anymore.

I can create a patch that makes read_bytes allocate an extra byte for a NUL terminator, like
read_string does (and like read_bytes used to), while still going through the custom allocator.
 This is the solution I'd prefer, I think — but to do that, we'd have to nail down the
contract for avro_givebytes.

The issue here is that we need to keep track of the allocated size of the buffer if we want
to free it using the custom allocator.  We're already keeping track of the size of the actual
bytes value.  We could require that any buffer passed in to avro_givebytes be NUL terminated.
 Then we'd know to use (value_size + 1) as the allocated size when we free the buffer.  But
that would break any existing code that passes in a non-NUL-terminated buffer to avro_givebytes.

I think a better solution would be to update avro_givebytes to take in a custom free function.
 Then read_bytes would provide a free function that knows that its buffer is NUL terminated.
 I think that's the proper way to have a bytes datum wrap a buffer that may or may not have
been allocated by the avro library itself.  It would also allow us to deprecate the avro_wrapbytes
function, since it would just be a special case of the avro_givebytes function.  That would
be a breaking API change though — would that be a deal-breaker?

> C: examples/quickstep segfaults
> -------------------------------
>                 Key: AVRO-741
>                 URL: https://issues.apache.org/jira/browse/AVRO-741
>             Project: Avro
>          Issue Type: Bug
>          Components: c
>            Reporter: Doug Cutting
>            Priority: Blocker
>             Fix For: 1.5.0
> On ubuntu 10.10 32-bit, 'cd lang/c; configure ; make check' currently fails.  The failure
is when running examples/quickstep:
> {code}
> make[2]: Entering directory `/home/cutting/src/avro/trunk/lang/c/examples'
> Successfully added Hicks, Dante id=1
> Successfully added Graves, Randal id=2
> Successfully added Loughran, Veronica id=3
> Successfully added Bree, Caitlin id=4
> Successfully added Silent, Bob id=5
> Successfully added ???, Jay id=6
> Now let's read all the records back out
> Error printing person
> FAIL: quickstop
> {code}

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message