HTTPS-WebService Client kills our app

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

HTTPS-WebService Client kills our app

Postby bonndias » Tue Jan 13, 2009 5:13 am

Hi,
in Oktober I asked for help on invoking a HTTPS-WebService from within Smalltalk in this thread:

Invoking HTTPS-WebService from VA 7.0?
viewtopic.php?f=12&t=2248

Everything worked fine in single user mode but in the meantime our app is used in production environment (heavy multi user) and now invoking the webService randomly leads to a not responding application.

Our App is a TCP/IP based server application runnning as windows service with Java-Clients, using a custom framework for the server part.
As a new requirement on logon of a Java-Client we call the HTTPS-WebService for authentification. This works fine but with multiuser access and heavy load the system fails to asnwer after an unpredictable amount of time. The application refuses to respond to any kind of request and can't even be stopped via windows management console.

My implementation is like this:

pruefeUser: aUser password: aPassword
| service |

self configure ifError: [:error | ^error].
service := self getWebService.
service ifError: [:error | ^error].

^service
invoke: 'checkPermission
withArguments: (
Array
with: aUser
with: aPassword

The webService is created like this:

getWebService: wsdlName
| container |

container :=
SstWSContainer
containerNamed: self containerName
ifNone: [
container := SstWSContainer createContainerNamed: self containerName.
container
deploy: wsdlName;
yourself].

^container allServices first

Best Regards
Joa
bonndias
 
Posts: 16
Joined: Mon Jun 09, 2008 4:15 am

Re: HTTPS-WebService Client kills our app

Postby tstalzer » Tue Jan 13, 2009 6:04 am

Joa showed me the problem yesterday - here is some additional information

If he looks at the process via the "Sysinternals Process Explorer", the application (which is packaged as a Windows Service) is in a state "Wait:DelayExecution".

The server operating system is Windows 2003 server.

The fault can be reproduced using a tool which simulates a large number of clients. If the coding regarding the https WebService is commented out, the fault does not occur.

The application uses other Sockets to provide communication with the clients.

--Thomas
tstalzer
[|]
 
Posts: 65
Joined: Mon Oct 16, 2006 12:07 am
Location: Palma de Mallorca - Spain

Re: HTTPS-WebService Client kills our app

Postby tc » Tue Jan 13, 2009 6:53 am

Hello,

I want nail down the sequence of events, a java client connects to an app on the server and through a custom framework, your ST service makes a web service call to authenticate the logon?

How does the custom framework handle multiple logons coming in around the same time? Are they queued and fired off after the previous web service call was answered or are they fired off as the logon comes in?

--tc
tc
Moderator
 
Posts: 304
Joined: Tue Oct 17, 2006 7:40 am
Location: Raleigh, NC

Re: HTTPS-WebService Client kills our app

Postby tstalzer » Tue Jan 13, 2009 7:22 am

Hi tc

In the target implementation, a request gets sent to the server via a socket from a Java client. The server makes the https WebService call (using standard VA/Smalltalk WebService functionality - basically the code Joa mentioned in his link). After getting results from the WebService call, data is being sent back to the Java client.

Joa made a couple of tests, each with the same result

- forking of the WebService call in another thread and waiting for the results with a semaphore
- forking of the WebService call in another thread and returning "dummy" data to the Java client

None of these changes made a significant change.

The application works stable without the https WebService call (and it gets a couple thousand requests from the Java clients)

--Thomas
tstalzer
[|]
 
Posts: 65
Joined: Mon Oct 16, 2006 12:07 am
Location: Palma de Mallorca - Spain

Re: HTTPS-WebService Client kills our app

Postby tc » Tue Jan 13, 2009 8:05 am

Hello,

How many users/requests is a 'heavy' load?

I guess what I am trying to figure out is can the web service handle requests being fired off, should many logon requests come in at one time, ie is that contributing to the problem?

Thanks.

--tc
tc
Moderator
 
Posts: 304
Joined: Tue Oct 17, 2006 7:40 am
Location: Raleigh, NC

Re: HTTPS-WebService Client kills our app

Postby bonndias » Wed Jan 14, 2009 12:45 am

Hi,
we changed our test to invoke a different WebService using HTTP instead of HTTPS. Within 30 minutes ~3500 client logons were executed by 50 concurrent clients without any problems by our server. This leads us to suspect a problem using OpenSSL.

Any ideas?

Joa
bonndias
 
Posts: 16
Joined: Mon Jun 09, 2008 4:15 am

Re: HTTPS-WebService Client kills our app

Postby louis_andriese » Wed Jan 14, 2009 12:46 am

Hi,

this looks a lot like an issue we've had with outgoing https-calls hanging up our VA-service on windows. The problem was worked around by Instantiations (Solveig) by making all relevant openssl-calls sync. Since that fix we've never seen the issue again.

Kind regards,

Louis
Last edited by louis_andriese on Wed Jan 14, 2009 1:43 am, edited 1 time in total.
Louis Andriese
Manager ICT
Nationaal Spaarfonds (part of Delta Lloyd Group)
Waalwijk, the Netherlands
louis_andriese
 
Posts: 20
Joined: Thu Dec 13, 2007 5:19 am
Location: Waalwijk, The Netherlands

Re: HTTPS-WebService Client kills our app

Postby bonndias » Wed Jan 14, 2009 1:24 am

Hi Louis,
this looks a lot like an issue we've had with outgoing https-calls hanging up our VA-service on windows. The problem was worked around by Instantiations (Solveig) by making all relevant openssl-calls async. Since that fix we've never seen the issue again.

that sounds like a possible solution. Actually we are using VA 7.0.2, the version of SciSslSocketInterface is V 6.0.2. Are the changes you mentioned included in this version?

Joa
bonndias
 
Posts: 16
Joined: Mon Jun 09, 2008 4:15 am

Re: HTTPS-WebService Client kills our app

Postby louis_andriese » Wed Jan 14, 2009 1:41 am

Hi Joa,

no, the changes came to us in a post-7.5 update from Solveig.
For the rest: Alas, I'm only the manager ;-)
I'll ask one of our developers to reply with some more details.

kind regards,

Louis
Louis Andriese
Manager ICT
Nationaal Spaarfonds (part of Delta Lloyd Group)
Waalwijk, the Netherlands
louis_andriese
 
Posts: 20
Joined: Thu Dec 13, 2007 5:19 am
Location: Waalwijk, The Netherlands

Re: HTTPS-WebService Client kills our app

Postby benvandijk » Wed Jan 14, 2009 3:14 am

Hi Joa,

As Louis told you, we have the same problem. It is caused by the async calls to SSL on a multi core machine.
On a single core machine it works fine and it can also work fine one a multi core machine with a low workload.

I put the changes we got from solveig, along with a few changes of our own, in the attachment.

Hope this will solve your problem,

Ben
Attachments
httpsfix.zip
Fix for https client hang
(96.24 KiB) Downloaded 120 times
benvandijk
 
Posts: 45
Joined: Sun Feb 25, 2007 7:14 am
Location: Arnhem, Netherlands

Re: HTTPS-WebService Client kills our app

Postby tc » Wed Jan 14, 2009 6:26 am

Hello,

After your reading your reply, I did a search on Google:

http://www.ddj.com/architect/184416574
However, since the OpenSSL code has a UNIX heritage, most of the examples available assume a UNIX-style sockets architecture. The preferred Windows architecture of asynchronous sockets doesn't fit well with this


http://www.lenholgate.com/archives/000456.html
OpenSSL is an open source implementation of the SSL and TLS protocols. Unfortunately it doesn't play well with windows style asynchronous sockets.


--tc
tc
Moderator
 
Posts: 304
Joined: Tue Oct 17, 2006 7:40 am
Location: Raleigh, NC

Re: HTTPS-WebService Client kills our app

Postby bonndias » Thu Jan 15, 2009 12:03 am

Hi All,
the problem seems to be solved! We used Ben's code and in the meantime successfully executed our test with 50 concurrent users. Final tests are running at the moment, but the change to "call" instead of "asyncCall" seems to be necessary for using OpenSSL at least on Windows :( .

Thanks a lot

Joa
bonndias
 
Posts: 16
Joined: Mon Jun 09, 2008 4:15 am

Re: HTTPS-WebService Client kills our app

Postby bonndias » Sun Apr 05, 2009 11:22 pm

Unfortunately we did not achieve to bring our application to production using HTTPS-WebService client. Ben's fix seemed to solve the problem first. But later, when more tests were done, our application failed again. After a lot of testing and trying we can say:
If we use HTTPS to call a WebService our application fails. If we use HTTP to call a WebService our application runs without any problems.

After running a script for about an hour we get an TCP/IP error 10014 when trying to send an answer to a client request. The socket in error is the one, which did the accept in the main loop of our server. Our test simulates 30 to 60 clients working with our server application. Each client creates a socket, sends its request and waits for the answer, which is sent back on the same socket. While the client waits for the answer, the server does calculating, eventually calls a webservice using HTTPS, creates a PDF etc. For calculating etc. we use Dlls, which are called using the PlatformFuntion>>asyncCall: protocoll.

Regards

Joa
bonndias
 
Posts: 16
Joined: Mon Jun 09, 2008 4:15 am

Re: HTTPS-WebService Client kills our app

Postby marten » Mon Apr 06, 2009 12:54 am

After looking at OpenSSL I read, that their developers state, that OpenSSL is not thread safe by its own. To make it thread-safe one has to add two callbacks in its own program ?!
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: HTTPS-WebService Client kills our app

Postby bonndias » Mon Apr 06, 2009 1:43 am

Hi Marten,
we are using Ben's fix, which uses callWith: instead of asyncCallWith: when invoking a function call into the OpenSSL code. We even tried to serialize the calls to the HTTPS-WebService, but no success. Where do we have to register the callbacks? That's the first time I here of this.

Joa
bonndias
 
Posts: 16
Joined: Mon Jun 09, 2008 4:15 am

Next

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest