Unfortunately, the protocol buffer library was designed in an environment
where all code is statically-linked, and it probably won't work so well with
dynamically-loaded code.  The problem is that at start-up, descriptors are
built for each compiled-in message type and registered in a singleton
registry.  There is no code that removes the descriptors on shutdown.  In
your case, it looks like libprotobuf.so is staying loaded after your plugin
is shut down.  When it starts back up again, it tries to re-register its
descriptors, but this fails because the descriptors already exist.
You might be able to work around this by statically linking libprotobuf.a
into your .so.  That way, each time you load the library, a new registry
will be created.  You'll still have some memory leaks, though, as there are
a lot of data structures which are not properly destroyed when libprotobuf
is shut down (again, because the design assumed that the code would only be
unloaded when the process exits anyway).

It would probably be possible to rework parts of the library to make it more
friendly to plugins, if someone wants to spend time on this, but it will
take some effort.

On Mon, Sep 22, 2008 at 8:53 PM, <[EMAIL PROTECTED]> wrote:

>
> Hi. I have an plug-in based application under Linux that dynamically
> links in libprotobuf.so. The app's plug-ins also link in the library.
> This works fine when a plug-in is first dynamically loaded via
> dl_open(). However, if the plug-in is removed dl_close() and then re-
> opened, I get the following error:
>
>  libprotobuf ERROR google/protobuf/descriptor.cc:1778] Invalid proto
> descriptor for file "component_ec.proto":
> libprotobuf ERROR google/protobuf/descriptor.cc:1781]
> component_ec.proto: A file with this name is already in the pool.
>
>
> It appears that there is some unwanted state associated with open/
> close. Has anyone seen this type of issue? Any ideas?
>
> Thanks,
> Aaron
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to