-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix server-side fragmentation #1239
base: master
Are you sure you want to change the base?
Conversation
Old implementation attempted to implement fragmentation in the TAO_OutputCDR inserters, but this does not work because array and sequence types, including strings, were implemented at the ACE_OutputCDR layer, which remained oblivious to fragmentation. The old implementation also left TAO_OutputCDR with a dangerous interface. The write_xxx function inherited from ACE_OutputCDR did not fragment, only the inserters did. The new implementation fragments in the low-level write_1, write_2, write_4, write_8, write_16, and write_array functions, making these virtual to ensure that constructed types like arrays and sequences correctly fragment their elements, and similar for structs, etc.
Adding virtual will cost performance, a solution without virtual would be preferred |
Yes, understood, but avoiding virtual functions here is easier said than done because of the design of class Doing this without virtual functions will require more surgery to the design. One possibility would be to move the implementation of strings and associated encoders from the ACE layer to the TAO layer where the fragmentation support is available. A lot of implementation code would need to get moved, and I don't know if string encoding is required to be present at the ACE layer, i.e., when ACE_OutputCDR is used independent of TAO. Is it ever used that way? If the ACE implementation for string encoding must remain in ACE, then it could be duplicated at the TAO layer with fragmentation added, but this duplication would be highly undesirable from a maintainability standpoint. The only remaining possibility I see is to turn ACE_OutputCDR into a template class that takes a template parameter to customize the functions I had changed to virtual. This seems reasonable, but if we are not even allowed to use namespace std because we must support ancient compilers, how difficult will it be to avoid problems with template support for these ancient compilers? Anyway, the point is that there are obvious bugs when fragmentation is enabled server-side. Virtual functions are an easy fix. Fixing it by using templates may be a more efficient alternative, but I don't have the resources to pursue this alternative fix, and to be honest, it is much fun to work on ACE/TAO source code given the constraints and coding style that are being imposed because of ancient compiler support. |
One more comment about the desire to avoid virtual functions for performance reasons: Although Actually, even |
By the way, I'm not sure why the VS2017WChar build failed. This happens because some PIDL files are apparently not having their stubs generated, but the pull request didn't make any changes in this locus. |
This fixes issue #1201.
The existing implementation attempted to implement fragmentation in the
TAO_OutputCDR inserters, but this did not work because array
and sequence types, including strings, were implemented at
the ACE_OutputCDR layer, which remained oblivious to fragmentation.
The old implementation also left TAO_OutputCDR with a dangerous
interface. The write_xxx functions inherited from ACE_OutputCDR did
not fragment, only the inserters did.
The proposed implementation fragments in the low-level write_1, write_2,
write_4, write_8, write_16, and write_array functions, making these
virtual to ensure that constructed types like arrays and sequences
correctly fragment their elements, and similar for structs, etc.