Skip to content

SpnegoEngine thread safety #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fabienbancharel opened this issue Apr 25, 2012 · 6 comments
Closed

SpnegoEngine thread safety #94

fabienbancharel opened this issue Apr 25, 2012 · 6 comments
Assignees
Milestone

Comments

@fabienbancharel
Copy link

Hello,
Using gatling to load test a CAS with Spnego, I start to have NullPointerException at 20 concurrent users (all using my credentials).

The exception is :
java.io.IOException
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.construct
(NettyAsyncHttpProvider.java:658)
Caused by: java.lang.NullPointerException
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:2
36)
at sun.security.jgss.GSSContextImpl.initSecContext(GSSContextImpl.java:1
62)
at com.ning.http.client.providers.netty.spnego.SpnegoEngine.generateToke
n(SpnegoEngine.java:343)
at com.ning.http.client.providers.netty.NettyAsyncHttpProvider.construct
(NettyAsyncHttpProvider.java:656)
... 18 more

I identified two attributes in SpnegoEngine that make it non thread safe (gatling use only one NettyAsyncHttpProvider) :
private GSSContext gssContext = null;
private byte[] token;

They can be defined as local variables in generateToken method : NPE disappears, and it solves the load problem with gatling.
Could you integrate this modification ?

As I can now load test our CAS Spnego server, this makes my issue (https://github.com/sonatype/async-http-client/issues/83) less important (I dont succeed by the way).

Thanks for gatling users,
Fabien.

@jfarcand
Copy link
Contributor

Salut, do me a pull request with your change and I will integrate them. This is easier to track and less error prone. Thanks!

@fabienbancharel
Copy link
Author

This is my first pull request, so it is error prone, but I think #95 seems ok.
(I also made negotiationOid a local variable).

@slandelle
Copy link
Contributor

@jfarcand this one can be closed as the PR was merged.

@jeremystone
Copy link

Any chance of this fix getting into the 1.8 branch?

@slandelle
Copy link
Contributor

Backported, will be in next release.

@slandelle slandelle added this to the 1.8.4 milestone Mar 7, 2014
@slandelle slandelle self-assigned this Mar 7, 2014
@jeremystone
Copy link

Excellent! Many thanks.
On 7 Mar 2014 14:29, "Stephane Landelle" [email protected] wrote:

Backported, will be in next release.

Reply to this email directly or view it on GitHubhttps://github.com//issues/94#issuecomment-37028438
.

cs-workco pushed a commit to cs-workco/async-http-client that referenced this issue Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants