Skip to content

Int is not callble when converting BSON to Dict + segmentation fault #145

Description

@bvdmitri

I get this strange error only on Julia 1.12, the actions run is here

Julia 1.11 is fine. I also tried to bump to Mongoc 0.10 here, but got a segmentation fault

[08-25 11:29:45] Error: handle_connection handler error. 

===========================
HTTP Error message:

ERROR: MethodError: objects of type Int64 are not callable
The object of type `Int64` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Maybe you forgot to use an operator such as *, ^, %, / etc. ?
Stacktrace:
  [1] _get(iter_ref::Base.RefValue{Mongoc.BSONIter}, ::Type{Mongoc.IterateKeyValuePairs})
    @ Mongoc ~/.julia/packages/Mongoc/tgaoV/src/bson.jl:465
  [2] iterate(itr::Mongoc.BSONIterator{Mongoc.IterateKeyValuePairs}, state::Nothing)
    @ Mongoc ~/.julia/packages/Mongoc/tgaoV/src/bson.jl:484
  [3] iterate
    @ ~/.julia/packages/Mongoc/tgaoV/src/bson.jl:484 [inlined]
  [4] iterate
    @ ~/.julia/packages/Mongoc/tgaoV/src/bson.jl:490 [inlined]
  [5] Dict{String, Any}(kv::Mongoc.BSON)
    @ Base ./dict.jl:95
  [6] dict_with_eltype
    @ ./abstractdict.jl:639 [inlined]
  [7] Dict
    @ ./dict.jl:117 [inlined]
  [8] __database_op_get_model_instance(; token::String, instance_id::String)
    @ RxInferServer ~/work/RxInferServer/RxInferServer/src/tags/Models.jl:490

Activity

  1. bvdmitri commented on Aug 25, 2025

    @bvdmitri
    Author

    Tried Mongoc.as_dict but got a segmentation fault again

  2. rossviljoen commented on Dec 30, 2025

    @rossviljoen

    Iteration on BSON of type BSON_TYPE_BINARY (perhaps others as well) is what causes the segfault on 1.12 (but not 1.11):

    using Mongoc
    b = Mongoc.BSON("a" => UInt8[0x1, 0x2, 0x3]);
    iterate(b)
  3. ancapdev commented on Jan 7, 2026

    @ancapdev
    Collaborator

    Iteration on BSON of type BSON_TYPE_BINARY (perhaps others as well) is what causes the segfault on 1.12 (but not 1.11):

    using Mongoc
    b = Mongoc.BSON("a" => UInt8[0x1, 0x2, 0x3]);
    iterate(b)

    #149 Fixes this case for me on 1.12.2. I suspect it was trampling stack data (up to 3 bytes) depending on stack allocations. Could be very sensitive to inlining and codegen.

  4. ancapdev commented on Jan 14, 2026

    @ancapdev
    Collaborator

    Fixed in #149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions