[Solved]Exception on printDetailedInfo

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

[Solved]Exception on printDetailedInfo

Post by Vishal R » Mon Aug 27, 2018 3:01 am

I was following the example for TugOfWarController. I noticed that if I had to examine the model using the following code:

Code: Select all

osimModel.printDetailedInfo(si, std::cout);
I get the following exception
Exception thrown at 0x00007FF90633B5EB (msvcp120.dll) in exampleController.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF. (Frame not in module)

May I know why this error? I have the osim file in the same directory of executable.
Last edited by Vishal R on Tue Aug 28, 2018 2:41 am, edited 1 time in total.

Tags:

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Exception on printDetailedInfo

Post by jimmy d » Mon Aug 27, 2018 11:12 am

This may be an issue for the compiler;
https://stackoverflow.com/questions/479 ... -in-module

User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

Re: Exception on printDetailedInfo

Post by Vishal R » Mon Aug 27, 2018 1:58 pm

jimmy wrote:
Mon Aug 27, 2018 11:12 am
This may be an issue for the compiler;
https://stackoverflow.com/questions/479 ... -in-module
I tried using the help from stack overflow and few other suggestions on loading the symbols from the server and so on. But still of no help.

The error only happens when I try to call

Code: Select all

osim.printDetailedInfo(si,std::cout);
If I comment it, it works fine. Then I tried isolating the program with only loading the model and initializing system, then tried printing the detailed info, again this exception popped up(when using relwithDebInfo mode). When I tried running the release version, outside of VS, I get a force close. Any idea ?

User avatar
Ayman Habib
Posts: 2234
Joined: Fri Apr 01, 2005 12:24 pm

Re: Exception on printDetailedInfo

Post by Ayman Habib » Mon Aug 27, 2018 2:05 pm

Hi Vishal,

Did you build OpenSim from sources or you're trying to use the prebuilt libraries/distribution?

In the former case, I'd suggest you build RelWithDebInfo and step into the method to see the specific line that causes the problem. In the latter case there's a potential that the VisualStudio version and/or project settings you have are not consistent with those used to build the libraries.

Can you point out your scenario, which OpenSim version/installer you're using or else how you're obtaining the libraries, and how you're building the executable?

Best regards,
-Ayman

User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

Re: Exception on printDetailedInfo

Post by Vishal R » Mon Aug 27, 2018 2:43 pm

aymanh wrote:
Mon Aug 27, 2018 2:05 pm
Hi Vishal,

Did you build OpenSim from sources or you're trying to use the prebuilt libraries/distribution?

In the former case, I'd suggest you build RelWithDebInfo and step into the method to see the specific line that causes the problem. In the latter case there's a potential that the VisualStudio version and/or project settings you have are not consistent with those used to build the libraries.

Can you point out your scenario, which OpenSim version/installer you're using or else how you're obtaining the libraries, and how you're building the executable?

Best regards,
-Ayman
Hi Ayman
Thank for your quick reply.

I did not build OpenSim from sources, rather I am using the pre-built libraries from OpenSim Windows 64 bit version from https://simtk.org/frs/download_confirm. ... roup_id=91.

I am using Visual Studio 2017 Community Version on Windows 10 64 bit OS. Here is the snapshot of error that I see using Visual Studio:
Image

When I try running using command prompt, I see the following:
Image
I am not sure if that is supposed to be the output from printDetailedInfo method?

The program that I am trying to run is from the example provided in C:\OpenSim 3.3\sdk\APIExamples\ControllerExample
I did run CMake and followed instructions from the tutorial https://simtk-confluence.stanford.edu:8 ... r+Part+Two. As you can see, in the website this particular line was not mentioned but in the directory where OutputReference code was provided, line 270 mentions about this statement. Since I am new and learning how to use the OpenSim API, I tried to include and check how the result form printDetaliedInfo() would look like. This created the exception error. I have been working out the previous examples from Performing the simulation, creating analysis and so on without any trouble.

Thanks,
Vishal

User avatar
Ayman Habib
Posts: 2234
Joined: Fri Apr 01, 2005 12:24 pm

Re: Exception on printDetailedInfo

Post by Ayman Habib » Mon Aug 27, 2018 3:35 pm

Hi Vishal,

My guess at this point is that this is a compatibility issue between the VisualStudio version you're using now and the one that was used to build OpenSim 3.3. The reasons this is likely the case are:
1. OpenSim 3.3 was built with an earlier version of VisualStudio (before VS 2017 was ever published). In the past these differences caused unexpected behaviors and some crashes.
2. The stacktrace of the crash has msvcp120.dll which is the C++ runtime library, one of the main libraries that change between VisualStudio versions, your/our VisualStudio 2017 uses msvcp140.dll for example. Also the implicated std:: classes live there.

I don't know if the source code for OpenSim 3.3 would actually compile from scratch using VisualStudio 2017 (we post the source), if not I'd recommend you switch to OpenSim 4.0 Beta which is built using the latest compilers.

Best regards,
-Ayman

User avatar
Vishal R
Posts: 47
Joined: Wed Oct 29, 2014 4:20 pm

Re: Exception on printDetailedInfo

Post by Vishal R » Tue Aug 28, 2018 2:40 am

aymanh wrote:
Mon Aug 27, 2018 3:35 pm
Hi Vishal,

My guess at this point is that this is a compatibility issue between the VisualStudio version you're using now and the one that was used to build OpenSim 3.3. The reasons this is likely the case are:
1. OpenSim 3.3 was built with an earlier version of VisualStudio (before VS 2017 was ever published). In the past these differences caused unexpected behaviors and some crashes.
2. The stacktrace of the crash has msvcp120.dll which is the C++ runtime library, one of the main libraries that change between VisualStudio versions, your/our VisualStudio 2017 uses msvcp140.dll for example. Also the implicated std:: classes live there.

I don't know if the source code for OpenSim 3.3 would actually compile from scratch using VisualStudio 2017 (we post the source), if not I'd recommend you switch to OpenSim 4.0 Beta which is built using the latest compilers.

Best regards,
-Ayman
Hi Ayman,

I compiled the source code for OpenSim3.3 from scratch using VisualStudio 2017. And voila! it worked. I could see the output without any errors :)

Thanks a lot,
Vishal

POST REPLY