[Bug 846] New: Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

Summary: Unit tests not initializing TLSF?
Product: Toolchain
Version: 2.3.0
Platform: All
OS/Version: All
Status: NEW
Severity: critical
Priority: P3
Component: RTT
AssignedTo: orocos-dev [..] ...
ReportedBy: kiwi [dot] net [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

Created attachment 666
--> http://bugs.orocos.org/attachment.cgi?id=666
GDB session of corba-ipc-server

A failure in corba-ipc-server on Mac OS X, when corba-ipc-test is run, appears
to indicate that a TLSF memory pool has not been allocated by the test.
Grok'ing for init_memory_pool in all the RTT toolchain source does not show any
instance of it being called.

Are the unit tests initializing a real-time memory pool?
S

sroderick@mp rtt (toolchain-next)$ egrep -Ri init_memory_pool .
./rtt/os/tlsf/tlsf.c:size_t init_memory_pool(size_t mem_pool_size, void
*mem_pool)
./rtt/os/tlsf/tlsf.c:        ERROR_MSG("init_memory_pool (): memory_pool
invalid\n");
./rtt/os/tlsf/tlsf.c:        ERROR_MSG("init_memory_pool (): mem_pool must be
aligned to a word\n");
./rtt/os/tlsf/tlsf.c:        init_memory_pool(area_size, area);
./rtt/os/tlsf/tlsf.h:extern size_t init_memory_pool(size_t, void *);
./src/os/tlsf/tlsf.c~:size_t init_memory_pool(size_t mem_pool_size, void
*mem_pool)
./src/os/tlsf/tlsf.c~:        ERROR_MSG("init_memory_pool (): memory_pool
invalid\n");
./src/os/tlsf/tlsf.c~:        ERROR_MSG("init_memory_pool (): mem_pool must be
aligned to a word\n");
./src/os/tlsf/tlsf.c~:        init_memory_pool(area_size, area);

[Bug 846] Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED

--- Comment #7 from Peter Soetens <peter [..] ...> 2011-03-15 11:36:59 CET ---
(In reply to comment #6)
> Created attachment 671
> Additional patch for remaining unit tests
>
> It was just my oversight that the other tests weren't patched too.

All applied on toolchain-2.3

[Bug 846] Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

--- Comment #6 from S Roderick <kiwi [dot] net [..] ...> 2011-03-14 16:18:35 CET ---
Created attachment 671
--> http://bugs.orocos.org/attachment.cgi?id=671
Additional patch for remaining unit tests

It was just my oversight that the other tests weren't patched too.

[Bug 846] Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED

--- Comment #5 from Peter Soetens <peter [..] ...> 2011-03-14 15:46:13 CET ---
(In reply to comment #3)
> Created attachment 669
> Initialize TLSF memory pool in each unit test
>
> We should really fold this TLSF memory pool allocation into a class, use that
> here, and also install the class so that users can use it too.

Why didn't you modify test-runner.cpp ? It has the same issue, no ?

Peter

[Bug 846] Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

--- Comment #4 from Peter Soetens <peter [..] ...> 2011-03-14 11:29:14 CET ---
(In reply to comment #3)
> Created attachment 669
> Initialize TLSF memory pool in each unit test
>
> We should really fold this TLSF memory pool allocation into a class, use that
> here, and also install the class so that users can use it too.

Why are we allowing ORO_MEMORY_POOL to be undefined ? Shouldn't it:

- be defined in rtt-config.h
or
- be set to 1 always ?

Peter

[Bug 846] Unit tests not initializing TLSF?

On Mar 14, 2011, at 06:29 , Peter Soetens wrote:

>
> http://bugs.orocos.org/show_bug.cgi?id=846
>
> --- Comment #4 from Peter Soetens <peter [..] ...> 2011-03-14 11:29:14 CET ---
> (In reply to comment #3)
>> Created attachment 669
>> Initialize TLSF memory pool in each unit test
>>
>> We should really fold this TLSF memory pool allocation into a class, use that
>> here, and also install the class so that users can use it too.
>
> Why are we allowing ORO_MEMORY_POOL to be undefined ? Shouldn't it:
>
> - be defined in rtt-config.h
> or
> - be set to 1 always ?
>
> Peter

I'm not sure why we originally did it, but it basically keeps all the "internal" TLSF functions invisible; by default only tlsf_malloc(), tlsf_free(), etc, are visible. For user code, that probably makes sense, as the only time you need the functions inside the ORO_MEMORY_POOL code is when you initialize/shutdown a memory pool.

I suggest we either leave things as they are, or remove ORO_MEMORY_POOL completely.
S

[Bug 846] Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

--- Comment #3 from S Roderick <kiwi [dot] net [..] ...> 2011-03-14 00:32:37 CET ---
Created attachment 669
--> http://bugs.orocos.org/attachment.cgi?id=669
Initialize TLSF memory pool in each unit test

We should really fold this TLSF memory pool allocation into a class, use that
here, and also install the class so that users can use it too.

[Bug 846] Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

--- Comment #2 from S Roderick <kiwi [dot] net [..] ...> 2011-03-14 00:06:57 CET ---
Created attachment 668
--> http://bugs.orocos.org/attachment.cgi?id=668
What occurs in corba-ipc-test after the gdb session with corba-ipc-server is
terminated

[Bug 846] Unit tests not initializing TLSF?

http://bugs.orocos.org/show_bug.cgi?id=846

--- Comment #1 from S Roderick <kiwi [dot] net [..] ...> 2011-03-14 00:05:53 CET ---
Created attachment 667
--> http://bugs.orocos.org/attachment.cgi?id=667
GDB session of corba-ipc-test

corba-ipc-test was run after corba-ipc-server was manually started. Once the
segfault in the server occurs, the test locks up (as you'd expect)