Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.6.0
    • Component/s: c
    • Labels:
      None

      Description

      In one of my projects that uses Avro, I pass avro_datum_t instances between threads, using the reference count mechanism to make sure that they're not freed while any thread still has a reference to them. I was getting some spurious segfaults, which were caused by the fact that the reference counts aren't updated atomically. I've created a patch that implements atomic reference counts, using the OpenPA library to provide the atomic operations themselves. (That library is MIT licensed, so it can be included in the source tree.)

      Note that only avro_XXX_incref and avro_XXX_decref are thread-safe as a result of this patch. For all of the other library functions, the caller is still responsible for ensuring thread safety.

      The patch makes sure that the OpenPA code works in both the old autotools build and the newer CMake build.

      1. 0001-Atomic-reference-counts.patch
        13 kB
        Douglas Creager
      2. 0001-Performance-test-program.patch
        5 kB
        Douglas Creager
      3. 0002-Serialization-performance-test.patch
        4 kB
        Douglas Creager

        Activity

        Doug Cutting made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Douglas Creager made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.6.0 [ 12316198 ]
        Resolution Fixed [ 1 ]
        Douglas Creager made changes -
        Attachment 0001-Atomic-reference-counts.patch [ 12470946 ]
        Douglas Creager made changes -
        Attachment fixed-make-dist.patch [ 12469682 ]
        Douglas Creager made changes -
        Attachment 0001-Atomic-reference-counts.patch [ 12469208 ]
        Douglas Creager made changes -
        Douglas Creager made changes -
        Attachment 0001-Performance-test-program.patch [ 12470867 ]
        Douglas Creager made changes -
        Attachment fixed-make-dist.patch [ 12469682 ]
        Douglas Creager made changes -
        Attachment fixed-make-dist.patch [ 12469680 ]
        Douglas Creager made changes -
        Attachment fixed-make-dist.patch [ 12469680 ]
        Douglas Creager made changes -
        Attachment 0001-Atomic-reference-counts.patch [ 12469208 ]
        Douglas Creager made changes -
        Attachment 0001-Atomic-reference-counts.patch [ 12469205 ]
        Douglas Creager made changes -
        Description In one of my projects that uses Avro, I pass avro_datum_t instances between threads, using the reference count mechanism to make sure that they're not freed while any thread still has a reference to them. I was getting some spurious segfaults, which were caused by the fact that the reference counts are updated atomically. I've created a patch that implements atomic reference counts, using the [OpenPA library|http://trac.mcs.anl.gov/projects/openpa/] to provide the atomic operations themselves. (That library is MIT licensed, so it can be included in the source tree.)

        Note that only avro_XXX_incref and avro_XXX_decref are thread-safe as a result of this patch. For all of the other library functions, the caller is still responsible for ensuring thread safety.

        The patch makes sure that the OpenPA code works in both the old autotools build and the newer CMake build.
        In one of my projects that uses Avro, I pass avro_datum_t instances between threads, using the reference count mechanism to make sure that they're not freed while any thread still has a reference to them. I was getting some spurious segfaults, which were caused by the fact that the reference counts aren't updated atomically. I've created a patch that implements atomic reference counts, using the [OpenPA library|http://trac.mcs.anl.gov/projects/openpa/] to provide the atomic operations themselves. (That library is MIT licensed, so it can be included in the source tree.)

        Note that only avro_XXX_incref and avro_XXX_decref are thread-safe as a result of this patch. For all of the other library functions, the caller is still responsible for ensuring thread safety.

        The patch makes sure that the OpenPA code works in both the old autotools build and the newer CMake build.
        Douglas Creager made changes -
        Field Original Value New Value
        Attachment 0001-Atomic-reference-counts.patch [ 12469205 ]
        Douglas Creager created issue -

          People

          • Assignee:
            Douglas Creager
            Reporter:
            Douglas Creager
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development