We don't really have good support for dynamically loading and unloading protobuf code. That is something that might work, but we just don't have any tests for it and haven't made an effort to support that. However, you could give it a try and see if it works. I'm not too familiar with dynamic loading, but I would guess that it might be OK to call ShutdownProtobufLibrary() as long as the initialization code runs again before you start calling any protobuf code again.
On Monday, December 3, 2018 at 3:16:48 AM UTC-8, softs...@gmail.com wrote: > > Hello, > we have GRPC interface inside a proprietary Linux dynamic library *.so in > C++ which is loaded and unloaded in main process at runtime. > When we unload the library and try to load it again, we get the below > error. > > [libprotobuf ERROR google/protobuf/descriptor_database.cc:57] File already > exists in database: my_interface.proto > [libprotobuf FATAL google/protobuf/descriptor.cc:1314] CHECK failed: > generated_database_->Add(encoded_file_descriptor, size): > > To clean all internal static objects in protobuf library, we probably need > void protobuf::ShutdownProtobufLibrary() > But the documentation says: "However, it is not safe to use any other part > of the protocol buffers library after ShutdownProtobufLibrary() > <https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.common#ShutdownProtobufLibrary> > > has been called." > So this does not work completely, i.e. allow register and run services > again... It looks like a programmer got tired of solving all the involved > problems so it ended half-way? > Why "it is not safe", what is missing? Any workaround suggested? > > Thank you. > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To post to this group, send email to grpc-io@googlegroups.com. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/e06c62e7-793a-490a-95df-f8ee60a43a92%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.