Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

2019-01-09 Thread Dave Barach via Lists.Fd.Io
NP, we’ve seen that one before, glad things are working properly now... D.

From: vpp-dev@lists.fd.io  On Behalf Of Anthony Linz
Sent: Wednesday, January 9, 2019 1:15 AM
To: vpp-dev@lists.fd.io
Subject: Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp 
#vppcapi

Dear Dave,
Thank you very much for your great and exact response.
The program now works like a dream.
Best wishes,
--
Anthony
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11885): https://lists.fd.io/g/vpp-dev/message/11885
Mute This Topic: https://lists.fd.io/mt/28972181/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp=1480452
Mute #binapi: https://lists.fd.io/mk?hashtag=binapi=1480452
Mute #vppcapi: https://lists.fd.io/mk?hashtag=vppcapi=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

2019-01-08 Thread Anthony Linz
Dear Dave,
Thank you very much for your great and exact response.
The program now works like a dream.
Best wishes,
--
Anthony
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11875): https://lists.fd.io/g/vpp-dev/message/11875
Mute This Topic: https://lists.fd.io/mt/28972181/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp=1480452
Mute #binapi: https://lists.fd.io/mk?hashtag=binapi=1480452
Mute #vppcapi: https://lists.fd.io/mk?hashtag=vppcapi=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

2019-01-08 Thread Dave Barach via Lists.Fd.Io
As usual, I’m off by a few characters. Sorry about that... See 
.../src/vppinfra/mem.h:

void *clib_mem_init (void *heap, uword size);
or
void *clib_mem_init_thread_safe (void *memory, uword memory_size);

From: vpp-dev@lists.fd.io  On Behalf Of Anthony Linz
Sent: Tuesday, January 8, 2019 8:08 AM
To: vpp-dev@lists.fd.io
Subject: Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp 
#vppcapi

Dear Dave,
Thanks for you reply.
I could not find "clib_memory_init()" in vpp.
Did you mean "vlibmemory_init()"?
If yes where and how in my code I should use it?
Thanks
--
Anthony
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11870): https://lists.fd.io/g/vpp-dev/message/11870
Mute This Topic: https://lists.fd.io/mt/28972181/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp=1480452
Mute #binapi: https://lists.fd.io/mk?hashtag=binapi=1480452
Mute #vppcapi: https://lists.fd.io/mk?hashtag=vppcapi=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

2019-01-08 Thread Anthony Linz
Dear Dave,
Thanks for you reply.
I could not find " clib_memory_init()" in vpp.
Did you mean "vlibmemory_init()"?
If yes where and how in my code I should use it?
Thanks
--
Anthony
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11869): https://lists.fd.io/g/vpp-dev/message/11869
Mute This Topic: https://lists.fd.io/mt/28972181/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp=1480452
Mute #binapi: https://lists.fd.io/mk?hashtag=binapi=1480452
Mute #vppcapi: https://lists.fd.io/mk?hashtag=vppcapi=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

2019-01-08 Thread Dave Barach via Lists.Fd.Io
Oh, oops, I meant “msp=0”. Anyhow, results will almost certainly improve if you 
call clib_memory_init(...)... ()...

From: vpp-dev@lists.fd.io  On Behalf Of Dave Barach via 
Lists.Fd.Io
Sent: Tuesday, January 8, 2019 7:38 AM
To: Anthony Linz ; vpp-dev@lists.fd.io
Cc: vpp-dev@lists.fd.io
Subject: Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp 
#vppcapi

Looks like a missing call to clib_memory_init(...). Note mspace=0...

HTH... Dave

From: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io> 
mailto:vpp-dev@lists.fd.io>> On Behalf Of Anthony Linz
Sent: Tuesday, January 8, 2019 4:44 AM
To: vpp-dev@lists.fd.io<mailto:vpp-dev@lists.fd.io>
Subject: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

Hi
Recently I tried to learn VPP's C API and I found a sample C program in 
https://www.marosmars.com/blog/managing-vpp-c-edition blog.
I have compiled the program like this:
gcc myprog.c -o myprog -lvppinfra -lvlibmemoryclient -lsvm
and it has been compiled successfully.
The problem is that when I try to run the program I will get segmentation fault 
like this:
program received signal SIGSEGV, Segmentation fault.
mspace_malloc (msp=0x0, bytes=bytes@entry=20) at 
/root/vpp/src/vppinfra/dlmalloc.c:4338
warning: Source file is more recent than executable.
4338   if (!PREACTION(ms)) {

And the back trace looks pretty like this:
#0  mspace_malloc (msp=0x0, bytes=bytes@entry=20) at 
/root/vpp/src/vppinfra/dlmalloc.c:4338
#1  0x77bb9308 in mspace_get_aligned (msp=0x0, n_user_data_bytes=20, 
n_user_data_bytes@entry=16, align=align@entry=8,
align_offset=align_offset@entry=8) at /root/vpp/src/vppinfra/dlmalloc.c:4177
#2  0x77bae5f8 in clib_mem_alloc_aligned_at_offset 
(os_out_of_memory_on_failure=1, align_offset=8, align=8, size=16)
at /root/vpp/src/vppinfra/mem.h:118
#3  vec_resize_allocate_memory (v=v@entry=0x0, 
length_increment=length_increment@entry=8, data_bytes=16, 
header_bytes=, header_bytes@entry=0,
data_align=data_align@entry=8) at /root/vpp/src/vppinfra/vec.c:59
#4  0x77b549a6 in _vec_resize_inline (data_align=, 
header_bytes=, data_bytes=,
length_increment=, v=) at 
/root/vpp/src/vppinfra/vec.h:147
#5  va_format (s=0x0, fmt=, va=va@entry=0x7fffe228) at 
/root/vpp/src/vppinfra/format.c:403
#6  0x77b548f7 in format (s=s@entry=0x0, fmt=fmt@entry=0x77929a4c 
"/dev/shm%s%c") at /root/vpp/src/vppinfra/format.c:423
#7  0x7791e524 in vl_map_shmem (region_name=0xc7a2 "/vpe-api", 
is_vlib=is_vlib@entry=0) at /root/vpp/src/vlibmemory/memory_shared.c:544
#8  0x7791f8cb in vl_client_api_map (region_name=) at 
/root/vpp/src/vlibmemory/memory_client.c:389
#9  0x7791f90c in connect_to_vlib_internal (svm_name=, 
client_name=0xcae9 "test", rx_queue_size=32, want_pthread=1,
do_map=) at /root/vpp/src/vlibmemory/memory_client.c:416
#10 0x74c6 in connect_to_vpe ()
#11 0x9261 in main ()

My Operating System is Ubuntu 18.04.01 and I have tested this on Ubuntu 16.04 
as well with the same result.
I was wondering if anyone could help me with the problem.
Thanks in advance for your help,
Best regards
--
Anthony
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11868): https://lists.fd.io/g/vpp-dev/message/11868
Mute This Topic: https://lists.fd.io/mt/28972181/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp=1480452
Mute #binapi: https://lists.fd.io/mk?hashtag=binapi=1480452
Mute #vppcapi: https://lists.fd.io/mk?hashtag=vppcapi=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

2019-01-08 Thread Dave Barach via Lists.Fd.Io
Looks like a missing call to clib_memory_init(...). Note mspace=0...

HTH... Dave

From: vpp-dev@lists.fd.io  On Behalf Of Anthony Linz
Sent: Tuesday, January 8, 2019 4:44 AM
To: vpp-dev@lists.fd.io
Subject: [vpp-dev] VPP 19.01 C API gets segmentation fault #binapi #vpp #vppcapi

Hi
Recently I tried to learn VPP's C API and I found a sample C program in 
https://www.marosmars.com/blog/managing-vpp-c-edition blog.
I have compiled the program like this:
gcc myprog.c -o myprog -lvppinfra -lvlibmemoryclient -lsvm
and it has been compiled successfully.
The problem is that when I try to run the program I will get segmentation fault 
like this:
program received signal SIGSEGV, Segmentation fault.
mspace_malloc (msp=0x0, bytes=bytes@entry=20) at 
/root/vpp/src/vppinfra/dlmalloc.c:4338
warning: Source file is more recent than executable.
4338   if (!PREACTION(ms)) {

And the back trace looks pretty like this:
#0  mspace_malloc (msp=0x0, bytes=bytes@entry=20) at 
/root/vpp/src/vppinfra/dlmalloc.c:4338
#1  0x77bb9308 in mspace_get_aligned (msp=0x0, n_user_data_bytes=20, 
n_user_data_bytes@entry=16, align=align@entry=8,
align_offset=align_offset@entry=8) at /root/vpp/src/vppinfra/dlmalloc.c:4177
#2  0x77bae5f8 in clib_mem_alloc_aligned_at_offset 
(os_out_of_memory_on_failure=1, align_offset=8, align=8, size=16)
at /root/vpp/src/vppinfra/mem.h:118
#3  vec_resize_allocate_memory (v=v@entry=0x0, 
length_increment=length_increment@entry=8, data_bytes=16, 
header_bytes=, header_bytes@entry=0,
data_align=data_align@entry=8) at /root/vpp/src/vppinfra/vec.c:59
#4  0x77b549a6 in _vec_resize_inline (data_align=, 
header_bytes=, data_bytes=,
length_increment=, v=) at 
/root/vpp/src/vppinfra/vec.h:147
#5  va_format (s=0x0, fmt=, va=va@entry=0x7fffe228) at 
/root/vpp/src/vppinfra/format.c:403
#6  0x77b548f7 in format (s=s@entry=0x0, fmt=fmt@entry=0x77929a4c 
"/dev/shm%s%c") at /root/vpp/src/vppinfra/format.c:423
#7  0x7791e524 in vl_map_shmem (region_name=0xc7a2 "/vpe-api", 
is_vlib=is_vlib@entry=0) at /root/vpp/src/vlibmemory/memory_shared.c:544
#8  0x7791f8cb in vl_client_api_map (region_name=) at 
/root/vpp/src/vlibmemory/memory_client.c:389
#9  0x7791f90c in connect_to_vlib_internal (svm_name=, 
client_name=0xcae9 "test", rx_queue_size=32, want_pthread=1,
do_map=) at /root/vpp/src/vlibmemory/memory_client.c:416
#10 0x74c6 in connect_to_vpe ()
#11 0x9261 in main ()

My Operating System is Ubuntu 18.04.01 and I have tested this on Ubuntu 16.04 
as well with the same result.
I was wondering if anyone could help me with the problem.
Thanks in advance for your help,
Best regards
--
Anthony
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#11867): https://lists.fd.io/g/vpp-dev/message/11867
Mute This Topic: https://lists.fd.io/mt/28972181/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp=1480452
Mute #binapi: https://lists.fd.io/mk?hashtag=binapi=1480452
Mute #vppcapi: https://lists.fd.io/mk?hashtag=vppcapi=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-