Skip to content
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

"Assigning to invalid map proxy value" crash on OSX - endToEnd tutorial #78

Closed
robpieke opened this issue Oct 11, 2016 · 12 comments
Closed

Comments

@robpieke
Copy link
Contributor

On OSX, after building USD with the customisations suggested in Issue 19, I get a crash partway through the endToEnd tutorial.

The create_asset.py script runs cleanly, but the add_shadingVariants.py script bails:

$ python tutorial_scripts/add_shadingVariants.py

(TfDiagnosticType)1: in _DefineCppType at line 868 of pxr//Users/robpieke/dev/github/USD/pxr/base/lib/tf/type.cpp -- TfType 'TfDebugSymbolsChangedNotice' already has a defined C++ type; cannot redefine
(TfDiagnosticType)1: in _DefineCppType at line 868 of pxr//Users/robpieke/dev/github/USD/pxr/base/lib/tf/type.cpp -- TfType 'TfDebugSymbolEnableChangedNotice' already has a defined C++ type; cannot redefine

Traceback (most recent call last):
File "tutorial_scripts/add_shadingVariants.py", line 133, in
main()
File "tutorial_scripts/add_shadingVariants.py", line 46, in main
_AddShadingToBall(stage)
File "tutorial_scripts/add_shadingVariants.py", line 89, in _AddShadingToBall
shadingVariant.SetVariantSelection(variantName)
pxr.Tf.ErrorException:
Error in '>::_Set' at line 822 in file pxr//Users/robpieke/dev/github/USD/build/include/pxr/usd/sdf/mapEditProxy.h : 'Assigning to invalid map proxy value'

Please note the "TfDiagnosticType" warnings at the top are the result of the patch from Issue 19. I get those every time I import the python modules. I include them for completeness, but it's the trace below which is concerning.

@jtran56
Copy link

jtran56 commented Oct 11, 2016

Filed as internal issue #138602.

@drwave
Copy link

drwave commented Oct 13, 2016

Hmm, so I have USD w/Python compiled on my macOS machine, and just ran through the tutorial. I do get the same last error, but I don't see the diagnostic you do. Did you apply the fix the workaround to your tree?

https://github.com/zhoub/USD/commit/67200e58a7a1df276bc4caca00c04fabcc63ceb5

python tutorial_scripts/add_shadingVariants.py
Traceback (most recent call last):
File "tutorial_scripts/add_shadingVariants.py", line 133, in
main()
File "tutorial_scripts/add_shadingVariants.py", line 46, in main
_AddShadingToBall(stage)
File "tutorial_scripts/add_shadingVariants.py", line 89, in _AddShadingToBall
shadingVariant.SetVariantSelection(variantName)
pxr.Tf.ErrorException:
Error in '>::_Set' at line 822 in file pxr//Users/wave/Projects/usd/stage/include/pxr/usd/sdf/mapEditProxy.h : 'Assigning to invalid map proxy value'
[kelvin:~/tests] wave%

@drwave
Copy link

drwave commented Oct 13, 2016

Sorry, just read through issue 19 and realized that's where that fix I was referencing came from. What os release are you running?

@drwave
Copy link

drwave commented Oct 13, 2016

Also, I just tried this (in the same directory) on a Linux box w/our standard USD build on it, and it ran to completion, so there definitely seems to be something fishy going on with the build on the mac.

Investigating...

@drwave
Copy link

drwave commented Oct 13, 2016

Okay, here's a minimal piece of Python that demonstrates the problem on my Mac build but works fine on our standard USD build on Linux:

from pxr import Usd
stage = Usd.Stage.CreateNew("/tmp/foo.usda")
model = stage.OverridePrim('/Ball')
shadingVariant = model.GetVariantSets().FindOrCreate('shadingVariant')
shadingVariant.SetVariantSelection("Boom")
print "made it!"

@robpieke
Copy link
Contributor Author

Glad I'm not the only sufferer :)

@drwave
Copy link

drwave commented Oct 13, 2016

For those that want to dig a little deeper in C++, here's that code (giving the same error) transliterated into C++:

std::string path("/tmp/foo.usda");
UsdStageRefPtr stage = UsdStage::Open(path);
SdfPath primPath("/Ball");
UsdPrim prim = stage->OverridePrim(primPath);
UsdVariantSet shadingVariant = prim.GetVariantSets().FindOrCreate("shadingVariant");
// this next line generates a coding error on the Mac, but seems to work fine on Linux
// Coding Error: in _Set at line 822 of pxr//Users/wave/Projects/usd/stage/include/pxr/usd/sdf/mapEditProxy.h -- Assigning to invalid map proxy value
shadingVariant.SetVariantSelection("Boom");

@meshula
Copy link
Member

meshula commented Oct 13, 2016

Confirmed here as well.

@meshula
Copy link
Member

meshula commented Oct 15, 2016

A Debug build works properly. Release doesn't. Still investigating.

@sunyab
Copy link
Contributor

sunyab commented Nov 4, 2016

I poked at this a little bit. In SdfMapEditProxy::_Get, we're comparing against a default-constructed std::map iterator as a safety check. It turns out this is undefined behavior; comparisons against a singular iterator are undefined per the C++ standard 24.1/5. A fix ought to be pretty straightforward.

@drwave
Copy link

drwave commented Nov 4, 2016

That’s great news!

On Nov 4, 2016, at 10:28 AM, Sunya Boonyatera [email protected] wrote:

I poked at this a little bit. In SdfMapEditProxy::_Get, we're comparing against a default-constructed std::map iterator as a safety check. It turns out this is undefined behavior; comparisons against a singular iterator are undefined per the C++ standard 24.1/5. A fix ought to be pretty straightforward.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #78 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ABmgOs0jMiuFCU4-m-pSVVtxE6JhCm-Xks5q62szgaJpZM4KUBkt.

@meshula
Copy link
Member

meshula commented Nov 4, 2016

Oh! Good find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants