|
|
Home » U++ Library support » U++ MT-multithreading and servers » Bug with socket
Bug with socket [message #31550] |
Sun, 13 March 2011 11:51  |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
App hangs, endless loop, CPU near 100% on one core.
This is only when the server is unavailable.
win32-3274
This can be duplicated with: C:\upp\reference\SocketClient
Socket s;
if(!ClientSocket(s, "127.0.0.1", 5024)) {
This is when compiled with Win XP with MSC9, 10 or Mingw
It runs OK in Win.
When running the app in Ubuntu 10.10 with Wine is when it hangs.
It took me more than 8 hours to track it down, much of that time
was spent looking for errors in my code.
Finally I was able to find that older versions of Upp worked OK.
Copying socket.cpp and socket.h from the older versions into the
latest (3274) worked also.
Checked to see where the problem started:
3226 and earlier OK
3233 and later it just hangs at, "if(!ClientSocket(s ...".
try/catch will not work either.
Neil
|
|
|
|
Re: Bug with socket [message #31569 is a reply to message #31550] |
Tue, 15 March 2011 07:51   |
|
nlneilson wrote on Sun, 13 March 2011 12:51 | App hangs, endless loop, CPU near 100% on one core.
This is only when the server is unavailable.
win32-3274
This can be duplicated with: C:\upp\reference\SocketClient
Socket s;
if(!ClientSocket(s, "127.0.0.1", 5024)) {
This is when compiled with Win XP with MSC9, 10 or Mingw
It runs OK in Win.
When running the app in Ubuntu 10.10 with Wine is when it hangs.
It took me more than 8 hours to track it down, much of that time
was spent looking for errors in my code.
Finally I was able to find that older versions of Upp worked OK.
Copying socket.cpp and socket.h from the older versions into the
latest (3274) worked also.
Checked to see where the problem started:
3226 and earlier OK
3233 and later it just hangs at, "if(!ClientSocket(s ...".
try/catch will not work either.
Neil
|
What about to try ZeroMQ library?
If you have the sourcecode I can convert it.
Best regards, Ion.
|
|
|
Re: Bug with socket [message #31572 is a reply to message #31550] |
Tue, 15 March 2011 10:28   |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Thanks Ion but that would be more complicated than necessary.
It's basically just the code in C:\upp\reference\SocketClient\SocketClient.cpp
which hangs the same with a Win .exe run in Linux with Wine.
String snd(String r, int a){
Socket s;
if(!ClientSocket(s, "127.0.0.1", 5024)) {
return "x";
}
if(IO) s.Write(r + "\n");
if(a==1 && IO){
String st = s.ReadUntil('\n');
return st;
}
return "y";
}
The code where the app hangs is:
if(!ClientSocket(..
when the server socket is not available, has not been opened, has been closed or whatever, it hangs.
Using socket.cpp and socket.h from 3226 or earlier fixes my problem.
I pointed this problem out in case someone else runs into it or if it needs to be fixed.
Neil
[Updated on: Tue, 15 March 2011 11:08] Report message to a moderator
|
|
|
Re: Bug with socket [message #31606 is a reply to message #31572] |
Thu, 17 March 2011 09:21   |
|
nlneilson wrote on Tue, 15 March 2011 11:28 | Thanks Ion but that would be more complicated than necessary.
It's basically just the code in C:\upp\reference\SocketClient\SocketClient.cpp
which hangs the same with a Win .exe run in Linux with Wine.
String snd(String r, int a){
Socket s;
if(!ClientSocket(s, "127.0.0.1", 5024)) {
return "x";
}
if(IO) s.Write(r + "\n");
if(a==1 && IO){
String st = s.ReadUntil('\n');
return st;
}
return "y";
}
The code where the app hangs is:
if(!ClientSocket(..
when the server socket is not available, has not been opened, has been closed or whatever, it hangs.
Using socket.cpp and socket.h from 3226 or earlier fixes my problem.
I pointed this problem out in case someone else runs into it or if it needs to be fixed.
Neil
|
can you test "ZMQ_HelloeWorld_Srv" and "ZMQ_HelloWorld_Clnt" from bazaar?
I tried to test "ZMQ_HelloWorld_Clnt" with "SocketServer" but it seems to be incompatible.
|
|
|
|
|
Re: Bug with socket [message #31667 is a reply to message #31651] |
Sat, 19 March 2011 03:18   |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
Hi Mirek
The app is multithreaded.
I have several Upp apps with the same socket setup.
They are all good with the 3226 or earlier socket.cpp and socket.h
I just tried with 3280.
Same error on one machine and OK on another with the same version/updates for Ubuntu 10.10 and Wine 1.2.2.
Attached are 3 files
3226 has no problems
3274 hangs on both computers
3280 OK on one hangs on another.
These apps start by sending config data, no other app is required.
As mentioned this can be duplicated, same hang, with C:\upp\reference\SocketClient\SocketClient.cpp
Also I will mention again the hang is when running the .exe on Linux with Wine.
The change appears to be about the time IPv6 support was being added.
edit: One difference I noticed was 3233 through 3274 created a .buglog, 3280 does not.
Neil
[Updated on: Sat, 19 March 2011 04:48] Report message to a moderator
|
|
|
Re: Bug with socket [message #31668 is a reply to message #31606] |
Sat, 19 March 2011 03:32   |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
tojocky wrote on Thu, 17 March 2011 09:21 | can you test "ZMQ_HelloeWorld_Srv" and "ZMQ_HelloWorld_Clnt" from bazaar?
I tried to test "ZMQ_HelloWorld_Clnt" with "SocketServer" but it seems to be incompatible.
|
I will try.
Have you tried with 3226 or earlier?
edit: How do you get to "bazaar" in theIde??
I copied the three ZMQ folders from bazaar to examples.
Both the _Srv and _Clnt have multiple errors:
ZMQ.lib(dist.obj) : error LNK2001: unresolved external symbol __imp__zmq_msg_close
Have I missed linking something?
Neil
[Updated on: Sat, 19 March 2011 05:38] Report message to a moderator
|
|
|
|
|
|
|
Re: Bug with socket [message #31687 is a reply to message #31685] |
Sat, 19 March 2011 23:50   |
 |
mirek
Messages: 14257 Registered: November 2005
|
Ultimate Member |
|
|
nlneilson wrote on Sat, 19 March 2011 18:05 | Hi Mirek
What I meant by "hang" was the app would stop at this line"
if(!ClientSocket(s, "127.0.0.1", 5024)) {
I put an Exclamation("... before and after that line, the one after that line never displayed.
On a dual core one core would have CPU 98~102
On a single core it would lock up and only pushing the power button to turn the computer off, nothing else would work.
I did notice "PANIC: Missing font Times New Roman"
I spent a couple hours on the single core computer to install the MS fonts.
That probably explains why an .exe made with upp 3280 worked on that computer and not the dual core. I will not do that on the dual core since that would mean another user would have to do the same thing.
If I use the socket.cpp and socket.h from 3226 or earlier the apps .exe can be run on Win and also Linux with Wine without problems.
I will see how things go with the next update when it is released after 3280. If there are problems I can always replace the socket.cpp and socket.h from 3226 or earlier, unless that procedure gets broken.
Neil
|
Sorry to ask, but from this long reply I cannot decode whether the issue is fixed...
Well, the font is one issue - but U++ needs at least 3 basic fonts and Times New Roman is standard font in Win32. So I guess this is not our fault.
Anyway, regarding Socket hang ups, does it work now?
|
|
|
Re: Bug with socket [message #31688 is a reply to message #31687] |
Sun, 20 March 2011 00:13   |
nlneilson
Messages: 644 Registered: January 2010 Location: U.S. California. Mojave &...
|
Contributor |
|
|
No, it does not work with 3233 through 3280.
Replacing socket.cpp and socket.h from 3226 or earlier is a hack that can be used.
If there is something specific added to support IPv6 that calls for a MS font rather than the fonts installed by default in Ubuntu/Wine may be the problem.
Upp 3226 and earlier DOES work OK.
[Updated on: Sun, 20 March 2011 00:36] Report message to a moderator
|
|
|
|
|
Re: Bug with socket [message #31692 is a reply to message #31689] |
Sun, 20 March 2011 10:50   |
|
mirek wrote on Sun, 20 March 2011 08:50 | Well, but fix is in 3286...
Mirek
|
Hello Mirek, the socket works only in single thread? What is the limitation?
|
|
|
|
Re: Bug with socket [message #32013 is a reply to message #32009] |
Sun, 17 April 2011 13:40   |
|
mirek wrote on Sat, 16 April 2011 22:26 |
tojocky wrote on Sun, 20 March 2011 05:50 |
Hello Mirek, the socket works only in single thread? What is the limitation?
|
Nope, MT is ok.
|
Sorry for confusing.
|
|
|
Goto Forum:
Current Time: Sat May 10 00:40:19 CEST 2025
Total time taken to generate the page: 0.01094 seconds
|
|
|