[XAM Developer] No XSystem returned with HTTP_Protocol_VIM

32 views
Skip to first unread message

ldeveaux

unread,
May 7, 2010, 2:29:09 PM5/7/10
to XAM Developers Group
Hi everybody,

To set the context, I'm working with C API on Linux. All the XAM
modules
have been compiled with "ant deliverables". The tests are OK for
Java_XAM_Library, Java_Reference_VIM and HTTP_Protocol_VIM (after
running "ant
server"). I don't have seen any test for C_XAM_Library.

So, I have created a small program to connect a XAM application with
the
HTTP_Protocol_VIM. I run the server using "ant server" first (on
127.0.0.1:9923). Secondly, I run my own application, the VIM is loaded
(libxam_vim_http64.so).

Unfortunately, no XSystem is returned after calling
XAMLibrary_Connect()
with
"snia-xam://Remote!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=
9923" as XRI.

See the log returned:
LogLevel Component Message
[none] [---] XAM SDK Logger Version 0.0.0
[debug] [xam_debug] ******* Start XAMLibrary Apply Configuration
Updates
*******
[debug] [xam_debug] CONFIG [xam_boolean] .xam.log.append = "false"
[debug] [xam_debug] CONFIG [xam_int] .xam.log.level = "5"
[debug] [xam_debug] CONFIG [xam_int] .xam.log.verbosity = "5"
[debug] [xam_debug] CONFIG
[xam_string] .xam.config.vim.alias.Remote =
"/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-GCC4_64/
http_vim/
libxam_vim_http64.so"
[debug] [xam_debug] CONFIG
[xam_string] .xam.config.vim.alias.stack =
"Remote:SNIA_Reference_VIM"
[debug] [xam_debug] CONFIG
[xam_string] .xam.config.vim.list.Remote =
"Remote"
[debug] [xam_debug] CONFIG
[xam_string] .xam.config.vim.lookuporder.1 =
"Remote"
[debug] [xam_debug] ******* End XAMLibrary Apply Configuration
Updates
*******
[info] [api_enter] XAMLibrary_Connect
[debug] [api_param] [in] [xam_string]
"snia-xam://Remote!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=
9923"
[debug] [api_param] [in] [xsystem_handle*] 0x7fffa145edf8
[info] [lib] Attempting to load library:
"/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-GCC4_64/
http_vim/
libxam_vim_http64.so"
[info] [lib] Successfully loaded library:
"libxam_vim_http64.so"
[debug] [lib] VIM_LOADED:
"/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-GCC4_64/
http_vim/
libxam_vim_http64.so"
[info] [vim_enter] VIM_CreateXSystem (libxam_vim_http64.so)
[debug] [vim_param] [in] [xsystem_handle*] 0x7fffa145edf8

See the gdb backtrace returned :
#0 0x00007ffff784f624 in __lll_lock_wait () from /lib64/libpthread.so.
0
#1 0x00007ffff784af35 in _L_lock_941 () from /lib64/libpthread.so.0
#2 0x00007ffff784ad58 in pthread_mutex_lock () from /lib64/
libpthread.so.0
#3 0x00007ffff7a9d1d9 in XAM_POSIX::xam_mutex_lock(pthread_mutex_t*)
()
from
/usr/lib64/libxam64.so.1
#4 0x00007ffff694d1f6 in RemoteVIM::FindDirectIndex(long) ()
from
/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-GCC4_64/
http_vim/
libxam_vim_http64.so
#5 0x00007ffff694e1a3 in RemoteVIM::RegisterXSystem(long) ()
from
/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-GCC4_64/
http_vim/
libxam_vim_http64.so
#6 0x00007ffff69536c2 in VIM_CreateXSystem () from
/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-GCC4_64/
http_vim/
libxam_vim_http64.so
#7 0x00007ffff7aaf8ad in XAM_VIM::CreateXSystem(long*) () from
/usr/lib64/libxam64.so.1
#8 0x00007ffff7a99f9f in XAM_Object::connect(XAM_VIM*, char*, long*)
()
from
/usr/lib64/libxam64.so.1
#9 0x00007ffff7a9e6d7 in XAM_Router::XAMLibrary_Connect(char const*,
long*) ()
from /usr/lib64/libxam64.so.1
#10 0x00007ffff7ac5f60 in XAMLibrary_Connect () from
/usr/lib64/libxam64.so.1
#11 0x0000000000400c62 in main (argc=1, argv=0x7fffffffd828) at
/home/l_dev/project/maquette_xam_project/maquette_xam/src/main.c:52

I don't know from where my problem occurs. Thanks for your answers.

--
You received this message because you are subscribed to the "XAM Developers Group" group.
To post to this group, send email to
xam-develo...@googlegroups.com
To unsubscribe from this group, send email to
xam-developers-g...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/xam-developers-group?hl=en
Reminder that due to the SNIA IP Policy, only bug reports can be accepted as feedback for the specification or code.

ldeveaux

unread,
May 10, 2010, 2:12:39 PM5/10/10
to XAM Developers Group
If I understand, to create an XSystem instance, the XAM application
has to use the XAMLibrary_Connect() operation with an XRI such as
"snia-xam://Remote!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote".
Calling this operation implies a communication with the HTTP client.
The HTTP client creates an HTTP request to send to the HTTP server.
And finally, the HTTP server queries an XSystem instance to the Java
Reference VIM.

I don't understand what is my mistake. Why my program is locked in the
RemoteVIM::RegisterXSystem() method ?
Even if the server is running and listening on the port 9923, my XAM
application doesn't return an XSystem (see my gdb backtrace in the
previous message).

Do I have to use another port to read data with the XAM application
because both server and client are in localhost ?
Maybe, the problem comes from my configuration file ? (see my log in
the previous message, particularly the CONFIG messages).
Or, the HTTP Protocol VIM and Java Reference VIM are misconfigured ?

Thanks in advance for your help.

Best regards,

Ludovic Deveaux
> For more options, visit this group athttp://groups.google.com/group/xam-developers-group?hl=en

Mike A

unread,
May 10, 2010, 6:41:27 PM5/10/10
to XAM Developers Group
For this example XRI, I would not use the word "Remote" twice. This
might be a source of your problem. Recode the XRI to look like:

"snia-xam://httpvim!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote

Where you have an alias mapping httpvim to the actual http client VIM
in your XAM Library config file. If you have not changed anything with
the HTTP VIM Server, connections should be made, and yes am XSystem
should be returned to you.

ldeveaux

unread,
May 11, 2010, 4:22:10 AM5/11/10
to XAM Developers Group
First of all, thanks Mike for your advices. But my problem is not
resolved.

Indeed, I have modified my XRI as follow : "snia-xam://httpvim!
localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote".
To match with a such XRI, I decided to use the default configuration
of the XAM modules (C_XAM_Library, Java_XAM_Library,
Java_Reference_VIM, HTTP_Protocol_VIM, Java_Interfaces).
For the XAM application, the config file is minimal :
.xam.config.vim.alias.httpvim=.../libxam_vim_http64.so
.xam.vim.list.httpvim=httpvim
.xam.log.append=FALSE
.xam.log.level=5
.xam.log.verbosity=5
.xam.log.path=<path>/<to>/<log>

However, the problem is the same : after launching the HTTP server
(ant server), the XAM application is locked and never returns an
XSystem instance.

Maybe the solution is one of my questions on my previous message :
Do I have to use another port to read data with the XAM application
because both server and client are in localhost ?
Maybe, the problem comes from my configuration file ?
Or, the HTTP Protocol VIM and Java Reference VIM are misconfigured ?

Thanks in advance for your help.

Best regards,

Ludovic Deveaux

ldeveaux

unread,
May 11, 2010, 7:50:33 AM5/11/10
to XAM Developers Group
I have run gdb with step for each "instruction" for my XAM application
and it seems doing an infinite loop.

If anybody can help me ...

Mike A

unread,
May 11, 2010, 10:25:29 AM5/11/10
to XAM Developers Group
You do not need to use another port to read data.

I wrote a simple program to connect to an HTTP Server and am seeing
the same thing as you.

What OS are you testing on? I am running on Ubuntu Linux (GCC4). Using
debugging, I see that the client is hung inside a lock (same place as
you). I am not familiar with the C XAM code enough to understand
exactly what is happening and why. I'll try to take a look at it, but
since I don't have the resources to debug this, I can't promise that
I'll come up with an answer. Sorry.

Mike A

ldeveaux

unread,
May 11, 2010, 10:35:47 AM5/11/10
to XAM Developers Group
I'm testing on openSUSE (GCC4).

Thanks to have tried to resolve my problem. It is reassuring to see
that I'm not alone with this problem.
Maybe it will be interesting to report a bug.

Best regards,

Ludovic Deveaux
> ...
>
> plus de détails »

Mike A

unread,
May 12, 2010, 12:36:19 AM5/12/10
to XAM Developers Group
I think I solved the deadlock. I have a test working on RedHat, and I
suspect it will work on other Linux distributions too.

There are other problems with the HTTP VIM (not yet fixed), so you may
run into those. The simple stuff is working.

It's late here so I am shutting down. I will be posting a link to
where you can find code that fixes this problem. I have a collection
of defect repairs to SNIA 1.0.1 code that you will want. (6 files in
all). I'll be setting up a small repository with the fixes in them.

Stay tuned.
> ...
>
> read more »

Mike A

unread,
May 12, 2010, 2:35:19 PM5/12/10
to XAM Developers Group
I posted my fixes to the Google code group: http://code.google.com/p/xam-fixes/

You should pick up the two CPP files for the HTTP C VIM. These will
allow it to start working with the Reference VIM.

Please note that I've not done much unit testing so I can't guarantee
that the C HTTP VIM is working 100%. In fact I can guarantee that
there are probably more defects. I've also got a unit test program for
the C HTTP VIM, but it's not yet ready for prime time. When it is, I
will post it to the code group.

Give these a try and see how they work for you.

Mike A

ldeveaux

unread,
May 17, 2010, 7:09:11 AM5/17/10
to XAM Developers Group
Thanks for your bug fixes. I have all downloaded them.

Once the sources downloaded, I tried to use the Reference VIM through
the HTTP Protocol.
The previous dead lock seems fixed. However, no XSystem is returned.
Indeed, I'm trying to connect my XAM application with the following
xri :
snia-xam://httpvim!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote

My xam application config file contains the following line :
xam_string..xam.config.vim.alias.httpvim=/home/l_dev/project/
xamsdk-1.0.1/C_XAM_Library/deliverables/Linux-GCC4/lib/
libxam_vim_http64.so

Note that I have re-compiled the dynamic library in order to take in
account the bug fixes.

The log result is different than the previous error (see my previous
messages) :
[info] [vim_enter] VIM_XSystem_Connect (libxam_vim_http64.so)
[debug] [vim_param] [in] [xsystem_handle] 19620729
[debug] [vim_param] [in] [xam_string] "localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote"

The startup.properties file in the HTTP_Protocol_VIM directory
contains the following lines :
.org.snia.xam.vim.alias.Remote=SNIA_Reference_VIM
.org.snia.xam.vim.alias.xam_vim_http_g=SNIA_Reference_VIM
.org.snia.xam.vim.alias.SNIA_Reference_VIM=org.snia.xam.vim.reference.ReferenceVIM

The communication between the xam application and the http client VIM
seems work well. In my opinion, the problem is between the http server
vim and the reference vim. See the HTTPVimServer.log :
17 mai 2010 11:46:24
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect write
INFO: xri=snia-xam://Remote!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote
17 mai 2010 11:46:24
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect write
GRAVE: XAM ExceptionNo VIM found for VIM name 'Remote'
org.snia.xam.InvalidXRIException: No VIM found for VIM name 'Remote'
at
org.snia.xam.vim.isolation.server.util.VIMCache.getNextXri(Unknown
Source)
at
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect.write(Unknown
Source)
at
org.snia.xam.vim.isolation.server.http.HttpWriteGlue.write(Unknown
Source)
at
org.snia.xam.vim.isolation.server.http.HttpWriteGlue.handle(Unknown
Source)
at
org.snia.xam.vim.isolation.server.http.HttpGenericHandler.handle(Unknown
Source)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1807)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1757)
at org.mortbay.http.HttpServer.service(HttpServer.java:879)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:
789)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:
960)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:806)
at
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:
218)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:331)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:520)

In case of necessity, see my gdb result :
0x00007ffff6e32fbb in std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::assign(std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) () from /usr/
lib64/libstdc++.so.6
(gdb) bt
#0 0x00007ffff6e32fbb in std::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::assign(std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&) () from /usr/lib64/libstdc++.so.6
#1 0x00007ffff452fba6 in XferBuffer::ParseBytes() ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#2 0x00007ffff4530202 in XferBuffer::GetValue(char const*,
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>&) ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#3 0x00007ffff453083a in XferBuffer::GetHandle(char const*, long&) ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#4 0x00007ffff453deda in VIM_XSystem_Connect ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#5 0x00007ffff7ab4c20 in XAM_VIM::XSystem_Connect(long, char const*)
() from /usr/lib64/libxam64.so.1
#6 0x00007ffff7a99fbb in XAM_Object::connect(XAM_VIM*, char*, long*)
() from /usr/lib64/libxam64.so.1
#7 0x00007ffff7a9e6d7 in XAM_Router::XAMLibrary_Connect(char const*,
long*) () from /usr/lib64/libxam64.so.1
#8 0x00007ffff7ac5f60 in XAMLibrary_Connect () from /usr/lib64/
libxam64.so.1
#9 0x0000000000400ca7 in main (argc=1, argv=0x7fffffffd928) at /home/
l_dev/project/maquette_xam_project/maquette_xam/src/main.c:55

I hope my problem can be resolved easily.

Best regards,

Ludovic Deveaux
> ...
>
> plus de détails »

ldeveaux

unread,
May 17, 2010, 7:44:38 AM5/17/10
to XAM Developers Group
For more information:

Java_Reference_VIM test --> OK
Java_XAM_Library test --> OK
HTTP_Protocol_VIM test --> All failed with the message : No VIM found
for VIM name 'Remote'

Mike A

unread,
May 17, 2010, 11:52:20 AM5/17/10
to XAM Developers Group
The configuration file for the HTTP VIM server is incorrect. You need
to replace the line:

.org.snia.xam.vim.alias.Remote=SNIA_Reference_VIM

with this one

.org.snia.xam.vim.alias.Remote=dummy!SNIA_Reference_VIM

The HTTP Server uses something called "VIM Stacking" in the init file,
and it needs that fake name (dummy) as the first element. This feature
is not well thought out or integrated in the scheme and causes
confusion, such as here.

This is also why all the unit tests are failing.

Also please note that there are many errors in the C HTTP VIM. I'll be
be posting more fixes in the next few days. You are likely to
encounter errors right away since the C HTTP VIM is not passing
strings and XUIDs to the HTTP VIM server properly. For instance, once
created, and XSet can not be opened via XSystem_OpenXSet.

Stay tuned for more fixes. In the meantime, fix your HTTP VIM Server
config file.
> ...
>
> read more »

ldeveaux

unread,
May 18, 2010, 7:48:38 AM5/18/10
to XAM Developers Group
I have replaced the line
.org.snia.xam.vim.alias.Remote=SNIA_Reference_VIM

by
.org.snia.xam.vim.alias.Remote=dummy!SNIA_Reference_VIM

and the problem is the same.

The unit tests now are OK.
The log result is the same as before. The gdb backtrace is :

#0 0x00007ffff452fabb in XferBuffer::ParseBytes() ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#1 0x00007ffff4530202 in XferBuffer::GetValue(char const*,
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>&) ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#2 0x00007ffff453083a in XferBuffer::GetHandle(char const*, long&) ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#3 0x00007ffff453deda in VIM_XSystem_Connect ()
from /home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/deliverables/
Linux-GCC4/lib/libxam_vim_http64.so
#4 0x00007ffff7ab4c20 in XAM_VIM::XSystem_Connect(long, char const*)
() from /usr/lib64/libxam64.so.1
#5 0x00007ffff7a99fbb in XAM_Object::connect(XAM_VIM*, char*, long*)
() from /usr/lib64/libxam64.so.1
#6 0x00007ffff7a9e6d7 in XAM_Router::XAMLibrary_Connect(char const*,
long*) () from /usr/lib64/libxam64.so.1
#7 0x00007ffff7ac5f60 in XAMLibrary_Connect () from /usr/lib64/
libxam64.so.1
#8 0x0000000000400ce2 in main (argc=1, argv=0x7fffffffd928) at /home/
l_dev/project/maquette_xam_project/maquette_xam/src/main.c:50

Some bugs seem persist, I'm waiting your future bug fixes in the next
few days.

Best regards,

Ludovic Deveaux
> ...
>
> plus de détails »

Mike A

unread,
May 18, 2010, 5:08:02 PM5/18/10
to XAM Developers Group
The problem is still that the HTTP VIM Server can not find the remote
VIM named in the XRI. You had it working at one point, but something
change. Either a configuration, or the XRI in your test program.
> ...
>
> read more »

ldeveaux

unread,
May 20, 2010, 5:39:04 AM5/20/10
to XAM Developers Group
I think you are certainly right when you say that this is a
configuration
problem or a bad XRI in my XAM application. However, I have not
managed to
resolve my problem. Here are the information needed to understand my
mistake.

XAM config file:
-----
# C VIM aliases
xam_string..xam.config.vim.alias.httpvim=/home/l_dev/project/
xamsdk-1.0.1/C_XAM_Library/objects/Linux-GCC4/lib/libxam_vim_http64.so

# Logging
xam_boolean..xam.log.append=FALSE
xam_int..xam.log.level=5
xam_string..xam.log.path=/home/l_dev/project/maquette_xam_project/
maquette_xam/log/maquette.log
xam_int..xam.log.verbosity=5
-----

XAM application source:
-----
xam_string vXRI = "snia-xam://httpvim!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote";
xsystem_handle* vXSystem =
(xsystem_handle*)malloc(sizeof(xsystem_handle));
xam_status vStatus = XAMLibrary_Connect( vXRI, vXSystem );
-----

XAM application log:
-----
1274347725805 2010-05-20 09:28:45.805 [info] 23306.139784920692528
[vim_enter] VIM_XSystem_Connect (libxam_vim_http64.so)
1274347725805 2010-05-20 09:28:45.805 [debug] 23306.139784920692528
[vim_param] [in] [xsystem_handle] 19620729
1274347725805 2010-05-20 09:28:45.805 [debug] 23306.139784920692528
[vim_param] [in] [xam_string] "localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote"
-----

HTTPVimServer.log:
-----
20 mai 2010 11:28:45
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect write
INFO: xri=snia-xam://Remote!localhost?
targetServer.ipAddress=127.0.0.1&targetServer.port=9923&targetServer.vimname=Remote
20 mai 2010 11:28:45
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect write
INFO: Loading VIM for name 'org.snia.xam.vim.reference.ReferenceVIM'
20 mai 2010 11:28:45
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect write
INFO: creating XSystem=snia-xam://
org.snia.xam.vim.reference.ReferenceVIM!localhost?
targetServer.vimname=Remote&targetServer.ipAddress=127.0.0.1&targetServer.port=9923
20 mai 2010 11:28:45
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect write
INFO: XSystem[-1].connect()
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect write
INFO: Return XSystem handle: 1274347726820
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.verbosity/xam_int
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.config.vim.alias.httpvim/xam_string
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.max.size/xam_int
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.path/xam_string
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.message.filter/xam_string
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.level/xam_int
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.append/xam_boolean
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.component.filter/xam_string
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.max.rollovers/xam_int
20 mai 2010 11:28:46
org.snia.xam.vim.isolation.server.http.handlers.XSystemConnect
processConnectBuffer
INFO: Init Param .xam.log.format/xam_int
-----

GDB output:
-----
#0 0x00007ffff452eb1a in XferBuffer::ParseBytes() ()
from
/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-
GCC4_64/http_vim/libxam_vim_http64.so
#1 0x00007ffff452f212 in XferBuffer::GetValue(char const*,
std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&) ()
from
/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-
GCC4_64/http_vim/libxam_vim_http64.so
#2 0x00007ffff452f77a in XferBuffer::GetHandle(char const*, long&) ()
from
/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-
GCC4_64/http_vim/libxam_vim_http64.so
#3 0x00007ffff453cfba in VIM_XSystem_Connect ()
from
/home/l_dev/project/xamsdk-1.0.1/C_XAM_Library/objects/Linux-
GCC4_64/http_vim/libxam_vim_http64.so
#4 0x00007ffff7ab4c20 in XAM_VIM::XSystem_Connect(long, char const*)
() from
/usr/lib64/libxam64.so.1
#5 0x00007ffff7a99fbb in XAM_Object::connect(XAM_VIM*, char*, long*)
() from
/usr/lib64/libxam64.so.1
#6 0x00007ffff7a9e6d7 in XAM_Router::XAMLibrary_Connect(char const*,
long*)
() from /usr/lib64/libxam64.so.1
#7 0x00007ffff7ac5f60 in XAMLibrary_Connect () from /usr/lib64/
libxam64.so.1
#8 0x0000000000400ce2 in main (argc=1, argv=0x7fffffffd9b8) at /home/
l_dev/project/maquette_xam_project/maquette_xam/src/main.c:50
-----

Note that the XAM SDK configuration files are the originals and all
unit tests
provided by SNIA XAM SDK pass.

I apologize for the length of the message, I hope that the information
is relevant.

Thanks in advance for your help,

Ludovic Deveaux
> ...
>
> plus de détails »

ldeveaux

unread,
May 20, 2010, 10:40:16 AM5/20/10
to XAM Developers Group
Hi,

It seems to finally work as intended. I think the problem is a bad
comparison in the XferBuffer.cpp file between an integer and a size_t
variables.

Please apply the following patch if you find it relevant:

--- XferBuffer.cpp.old 2010-05-20 16:36:41.000000000 +0200
+++ XferBuffer.cpp 2010-05-20 16:31:16.000000000 +0200
@@ -54,7 +54,7 @@
{
// find the end of the name, marked by an '='
unsigned int vIndex2 = vUnparsedByteStr.find('=',
vIndex1);
- if ( vIndex2 == std::string::npos ) // didn't find the
separator
+ if ( vIndex2 == (unsigned int)std::string::npos ) //
didn't find the separator
{
vName.clear();
vValue.clear();
@@ -71,7 +71,7 @@
else // copy until the end of line (or end of
data)
{
vIndex2 = vUnparsedByteStr.find('\x00a', vIndex1);
- if ( vIndex2 == std::string::npos )
+ if ( vIndex2 == (unsigned
int)std::string::npos )
vIndex2 = (unsigned int)vNumBytes;

vValue = vUnparsedByteStr.substr(vIndex1, vIndex2 -
vIndex1);


Best regards,

Ludovic Deveaux

Mike A

unread,
May 20, 2010, 11:48:36 AM5/20/10
to XAM Developers Group
Really! Wow, I would not have thought to look there. Can you describe
exactly what was going wrong? The cast shouldn't have made any
difference, as the expression should have promoted both values to
signed, and the values should be low enough that sign wrap around
didn't occur. I don't see why it failed, but I'll take you word for
it.

The HTTP VIM Server log shows that the XSystem was created, but I
don't see anything indicating that it's returning a handle. I
certainly don't see an exception in there.

I'll test this little patch here, I expect that it will work.
> ...
>
> read more »

ldeveaux

unread,
May 21, 2010, 2:35:30 AM5/21/10
to XAM Developers Group
In the function ParseBytes(), although vIndex2 == -1, the program did
not enter within the "if vIndex2 == std::string::npos" to assign the
value of vNumBytes. Thus, the "while" loop was infinite. I don't know
if it is relevant, but cast std::string::npos solves the problem. I'll
do it this way until a better solution is provided.

Ludovic Deveaux
> ...
>
> plus de détails »

ldeveaux

unread,
May 21, 2010, 3:03:14 AM5/21/10
to XAM Developers Group
The real reason is that an "unsigned int" cannot be equal to -1. But,
std::string::npos == -1 and so cannot be comparated with vIndex2 which
is an unsigned int.
So, for me the better solution is to type vIndex1 and vIndex2 as "int"
and not "unsigned int" because they can be equal to -1.

You can try the following patch which works for me :

--- XferBuffer.cpp.old 2010-05-20 16:36:41.000000000 +0200
+++ XferBuffer.cpp 2010-05-21 09:02:10.000000000 +0200
@@ -49,11 +49,11 @@
// parse it into name value pairs now
std::string vName;
std::string vValue;
- unsigned int vIndex1 = 0;
+ int vIndex1 = 0;
while ( vIndex1 < vNumBytes )
{
// find the end of the name, marked by an '='
- unsigned int vIndex2 = vUnparsedByteStr.find('=',
vIndex1);
+ int vIndex2 = vUnparsedByteStr.find('=', vIndex1);
if ( vIndex2 == std::string::npos ) // didn't find the
separator
{
vName.clear();
@@ -72,7 +72,7 @@
{
vIndex2 = vUnparsedByteStr.find('\x00a', vIndex1);
if ( vIndex2 == std::string::npos )
- vIndex2 = (unsigned int)vNumBytes;
+ vIndex2 = (int)vNumBytes;

vValue = vUnparsedByteStr.substr(vIndex1, vIndex2 -
vIndex1);

Best regards,

Ludovic Deveaux

Mike A

unread,
May 21, 2010, 12:56:27 PM5/21/10
to XAM Developers Group
This is almost certainly a better fix, as find can fail usually
returning -1. My question is what is the value of the
UnparsedByteString that causes the failure? This helps in reproducing
the failure to determine if a better fix is available.
> ...
>
> read more »

ldeveaux

unread,
Jun 1, 2010, 4:38:14 AM6/1/10
to XAM Developers Group
The problem occured with this value of UnparsedByteString :
status=0
handle=1275381302001

However, I'm not sure that the information is useful because the
problem seems appear with any value of UnparsedByteString.

Best regards,

Ludovic Deveaux
> ...
>
> plus de détails »
Reply all
Reply to author
Forward
0 new messages