Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-51492

write_unit_of_work has circular typeinfo dependency to service_context

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Service Arch
    • ALL
    • Hide

      To reproduce on ubuntu 18.04 work station, remove the LIBDEPS_TAG attached to the write_unit_of_work library in the SConscript as shown by this patch diff:

      diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript
      index d8fc600d89..ef2aed6791 100644
      --- a/src/mongo/db/storage/SConscript
      +++ b/src/mongo/db/storage/SConscript
      @@ -359,9 +359,7 @@ env.Library(
               '$BUILD_DIR/mongo/util/fail_point',
               'recovery_unit_base',
           ],
      -    LIBDEPS_TAGS=[
      -        'libdeps-cyclic-typeinfo'
      -    ],
      +
       
       )
      

      Then build with this SCons invocation:

      python3 ./buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --dbg=on --opt=on --sanitize=undefined --ssl --enable-free-mon=on -j200 --separate-debug --install-action=hardlink --jlink=0.25 --cache-debug=scons_cache.log --debug=time --build-tools=next CCACHE=ccache ICECC=icecc --implicit-cache --build-fast-and-loose=on --link-model=dynamic install-unittests install-unittests-debug
      

      You should see a build failure like this:

      Linking build/optdebug/mongo/db/storage/libwrite_unit_of_work.so | LibdepLinter: Missing typeinfo definitions: undefined symbol: typeinfo for mongo::OperationContext (build/optdebug/mongo/db/storage/libwrite_unit_of_work.so)
      
      Show
      To reproduce on ubuntu 18.04 work station, remove the LIBDEPS_TAG attached to the write_unit_of_work library in the SConscript as shown by this patch diff: diff --git a/src/mongo/db/storage/SConscript b/src/mongo/db/storage/SConscript index d8fc600d89..ef2aed6791 100644 --- a/src/mongo/db/storage/SConscript +++ b/src/mongo/db/storage/SConscript @@ -359,9 +359,7 @@ env.Library(          '$BUILD_DIR/mongo/util/fail_point' ,          'recovery_unit_base' ,      ], -    LIBDEPS_TAGS=[ -        'libdeps-cyclic-typeinfo' -    ], + ) Then build with this SCons invocation: python3 ./buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --dbg=on --opt=on --sanitize=undefined --ssl --enable-free-mon=on -j200 --separate-debug --install-action=hardlink --jlink=0.25 --cache-debug=scons_cache.log --debug=time --build-tools=next CCACHE=ccache ICECC=icecc --implicit-cache --build-fast-and-loose=on --link-model=dynamic install-unittests install-unittests-debug You should see a build failure like this: Linking build/optdebug/mongo/db/storage/libwrite_unit_of_work.so | LibdepLinter: Missing typeinfo definitions: undefined symbol: typeinfo for mongo::OperationContext (build/optdebug/mongo/db/storage/libwrite_unit_of_work.so)
    • 4

      The library write_unit_of_work needs typeinfo for mongo::OperationContext in UBSAN builds, but if the library, service_context, which contains the definition of that typeinfo is linked to it, this caused a circular dependency between the two librarys.

       

      We need to extract the typeinfo definition into its own library that both write_unit_of_work and service_context can link, and any other librarys that need the mongo::OperationContext typeinfo defined.

      Acceptance Criteria:

      Remove dependency of service_context on write_unit_of_work via constructor actions or other decoupling mechanisms. 
      Verify that we have removed the circular dependency mentioned in the repro. 

       

            Assignee:
            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            Reporter:
            daniel.moody@mongodb.com Daniel Moody
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: