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

core dump #3

Closed
damian123 opened this issue Feb 5, 2012 · 16 comments
Closed

core dump #3

damian123 opened this issue Feb 5, 2012 · 16 comments
Assignees

Comments

@damian123
Copy link

I have a core dump when I call the tests project, at the place where run_client_test calls cli.call.
What is the best way to setup the build environment?

try {
i = cli.call("add", 12).get(); <----- here
}
catch (const std::exception& e)
{
printf("internal catch: %s\n", e.what());
}

void* msgpack_zone_malloc_expand(msgpack_zone* zone, size_t size)
{
msgpack_zone_chunk_list* const cl = &zone->chunk_list;

size_t sz = zone->chunk_size;

while(sz < size) {
    sz *= 2;
}

msgpack_zone_chunk* chunk = (msgpack_zone_chunk*)malloc(
        sizeof(msgpack_zone_chunk) + sz);

char* ptr = ((char*)chunk) + sizeof(msgpack_zone_chunk);

chunk->next = cl->head;     <------ crashes here
cl->head = chunk;
cl->free = sz - size;
cl->ptr  = ptr + size;

return ptr;

}

My platform is Windows 7 64 bit (using 32 only ... i think), Visual Studio 2010 SP1, Boost 1.48, MsgPack 0.5.4

@qehgt
Copy link
Owner

qehgt commented Feb 5, 2012

I'll check it

@ghost ghost assigned qehgt Feb 5, 2012
@qehgt
Copy link
Owner

qehgt commented Feb 5, 2012

Hmm... myRPC needs a patch to work with latest boost library on win32 platform. Did you make some changes in sources?

Anyway, I checked on Win7 64bit, MSVS Express 2010, Boost 1.48, MsgPack 0.5.4. Everything was compiled in 32-bit mode. Can not reproduce this issue.

@damian123
Copy link
Author

Thank you for investigating. I will try to take it in smaller steps and see where I made a mistake.

@qehgt
Copy link
Owner

qehgt commented Feb 6, 2012

Also checked in 64bit mode. Everything was recompiled to 64bit (boost/msgpack/myrpc). Still no issues.

@damian123
Copy link
Author

I tried to start from scratch but got stuck with a compiler error, and no header files are in msgpack/type.hpp so can't proceed.
Here is what I did.

  1. open command prompt
  2. git clone https://github.com/msgpack/msgpack.git
  3. open cpp solution and convert in Visual Studio 2010
    a) build but got an error: Cannot open include file: 'sysdep.h'
    added <msgpack_home>\msgpack to additional include directories
    b) build but got an error: Cannot open include file: 'msgpack/unpack_define.h'
    added <msgpack_home> to additional include directories
    c) build but got an error: Cannot open include file: 'zone.hpp'
    can only find the file zone.hpp.erb which configure is supposed to transform into a zone.hpp file.
    can't procees here... go to 4.
  4. Download msgpack-0.5.4.tar.gz from http://sourceforge.net/projects/msgpack/files/
  5. open msgpack_vc2008.sln and convert it in Visual Studio 2010
  6. Build succeeded. Test project not there.
  7. Run msgpack_vc.postbuild.bat
  8. git clone https://github.com/qehgt/myrpc.git
  9. convert project to Visual Studio 2010
  10. Replace additional include directories settings to point to my own boost installation
  11. Replace additional include directories settings to point msgpack-0.5.4\include
  12. Replace additional include directories settings to point myrpc\myrpc
  13. Added include path msgpack-0.5.4\src\msgpack
  14. Now I have these build errors:

1>------ Build started: Project: myrpc, Configuration: Debug Win32 ------
1> callable.cpp
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack/object.hpp(409): fatal error C1083: Cannot open include file: 'msgpack/type.hpp': No such file or directory
1> request.cc
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack/object.hpp(409): fatal error C1083: Cannot open include file: 'msgpack/type.hpp': No such file or directory
1> session.cpp
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack\sysdep.h(23): error C2371: 'int8_t' : redefinition; different basic types
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17) : see declaration of 'int8_t'
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack/object.hpp(409): fatal error C1083: Cannot open include file: 'msgpack/type.hpp': No such file or directory
1> stream_tcp_socket.cpp
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack\sysdep.h(23): error C2371: 'int8_t' : redefinition; different basic types
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17) : see declaration of 'int8_t'
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack/object.hpp(409): fatal error C1083: Cannot open include file: 'msgpack/type.hpp': No such file or directory
1> tcp_client.cpp
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack\sysdep.h(23): error C2371: 'int8_t' : redefinition; different basic types
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17) : see declaration of 'int8_t'
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack/object.hpp(409): fatal error C1083: Cannot open include file: 'msgpack/type.hpp': No such file or directory
1> tcp_server.cpp
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack\sysdep.h(23): error C2371: 'int8_t' : redefinition; different basic types
1> c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17) : see declaration of 'int8_t'
1>c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack/object.hpp(409): fatal error C1083: Cannot open include file: 'msgpack/type.hpp': No such file or directory
1> Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

@qehgt
Copy link
Owner

qehgt commented Feb 6, 2012

Nice description.

It's a bug in msgpack_vc.postbuild.bat from msgpack-0.5.4.tar.gz.
File type.hpp should be copied into include\msgpack directory, not into include\msgpack\type
So, move type.hpp from include\msgpack\type into include\msgpack to fix build.

@damian123
Copy link
Author

Thank you that was helpful for getting ride of the missing type.hpp.

I also have problems since int8_t seems to be defined in both Visual Studio 10's stdint.h and msgpack's sysdep.h.
Any idea how I get ride of this error?

Compiler output
1>------ Build started: Project: myrpc, Configuration: Debug Win32 ------
1> callable.cpp
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdint.h(17): error C2371: 'int8_t' : redefinition; different basic types
1> c:\dev\3rdparty\build\msgpack-rpc\msgpack-0.5.4\include\msgpack/sysdep.h(23) : see declaration of 'int8_t'

stdint.h contains this typedef: typedef signed char int8_t;
and sysdep.h contains this typedef: typedef __int8 int8_t;

@qehgt
Copy link
Owner

qehgt commented Feb 7, 2012

Your sysdep.h (from msgpack-0.5.4.tar.gz) is outdated. Take correct one from github repository https://github.com/msgpack/msgpack/raw/master/msgpack/sysdep.h

@damian123
Copy link
Author

Cool now I can build myrpc successfuly.
When I run test I get these errors on the console, I believe that my msgpack lib is not in a clean state now.
Will try to take a fresh git clone and merge Windows changes from msgpack-0.5.4. After all cpp version 0.5.4 is from 29 August 2010, quiet old.
Do you have any better ideas?

i = 1
internal catch: argument mismatch
i = 1
str = aaaBBB
i = 1
internal catch: argument mismatch
i = 1
i = 1
internal catch: argument mismatch
i = 1
str = aaaBBB
str = aaaBBB
Press any key to continue . . .

and on the debug out I have this:

First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: msgpack::type_error at memory location 0x028df7c8..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: boost::exception_detail::clone_implmsgpack::myrpc::argument_error at memory location 0x0320f79c..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: msgpack::type_error at memory location 0x028df7c8..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: boost::exception_detail::clone_implmsgpack::myrpc::argument_error at memory location 0x0300f570..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: boost::exception_detail::clone_implmsgpack::myrpc::argument_error at memory location 0x002cf764..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: boost::exception_detail::clone_implmsgpack::myrpc::argument_error at memory location 0x02b5f510..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: msgpack::type_error at memory location 0x028df7c8..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: boost::exception_detail::clone_implmsgpack::myrpc::argument_error at memory location 0x0270f310..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..
First-chance exception at 0x76b4b9bc in test.exe: Microsoft C++ exception: boost::exception_detail::clone_implmsgpack::myrpc::argument_error at memory location 0x02a1f938..

@qehgt
Copy link
Owner

qehgt commented Feb 7, 2012

"internal catch" is just a part of the test. It's expected to see it here.

"First-chance exception" is ok as well. MS debugger prints it every time when a exception is thrown. This test tries to call a function with wrong arguments, this is the reason of the exceptions.

@damian123
Copy link
Author

I tried to take the newst version of msgpack from git and added the files that configure will amend from msgpack 0.5.4.
Build myrpc again but still get this error when I run the test project:
i = 1
i = 1
i = 1
internal catch: argument mismatch
i = 1
internal catch: argument mismatch
i = 1
internal catch: argument mismatch
i = 1
str = aaaBBB
str = aaaBBB
str = aaaBBB
Press any key to continue . . .

@damian123
Copy link
Author

OK, I will close this ticket. Thank you!

@qehgt qehgt reopened this Feb 7, 2012
@qehgt
Copy link
Owner

qehgt commented Feb 7, 2012

Ok, I'll change the test to make its output more clear.

@qehgt qehgt closed this as completed Feb 7, 2012
@damian123
Copy link
Author

Acually it would be nice to have the original cpp unit tests from msgpack-rpc added to myrpc.
I will have a go at that tomorrow.

@qehgt
Copy link
Owner

qehgt commented Feb 7, 2012

That makes sense.

@qehgt
Copy link
Owner

qehgt commented Feb 7, 2012

I updated the test a little. Output now is better.

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

2 participants