Skip to content

Unable to add defs to DescriptorPool: Symtab already has a def named #381

Open
@bmarkons

Description

@bmarkons

When the Google::Protobuf::DescriptorPool.generated_pool.build is called twice with the same message types, the error is being thrown saying that DescriptorPool has already registered message with the same name. I see that as expected behavior.

Though, I need to include GRPC generated files within Rails codebase which some parts are eagerly loaded.

Is there any possible way to tell protobuf to generate Ruby classes and modules instead of generating Google::Protobuf::DescriptorPool.generated_pool.build block? In case it has generated classes, the require on that file more than once wouldn't throw an error.

I see here in example that you have generated class:
https://github.com/ruby-protobuf/protobuf/wiki/Compiling-Definitions
But not sure what I am missing...

I see the only way to fix this is to add some condition before Google::Protobuf::DescriptorPool.generated_pool.build block, letting it register messages unless these are already defined.

BTW I wanted to run gprc server within a rake task when I stumbled upon this issue.

Please tell me if I am missing something, which is quite likely. Thank you

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