You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2021/06/07 12:20:38 UTC

[Bug 65363] New: NullPointerException in HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizationForAuthScope when 401 response from remote and httpclient4.auth.preemptive=false

https://bz.apache.org/bugzilla/show_bug.cgi?id=65363

            Bug ID: 65363
           Summary: NullPointerException in
                    HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizatio
                    nForAuthScope when 401 response from remote and
                    httpclient4.auth.preemptive=false
           Product: JMeter
           Version: 5.4.1
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTTP
          Assignee: issues@jmeter.apache.org
          Reporter: plynch@apache.org
  Target Milestone: JMETER_5.5

Created attachment 37892
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37892&action=edit
JMeter test file issue reproduce case

1. Configure jmeter property to turn off pre-emptive auth. (
httpclient4.auth.preemptive=false )
2. Have a server endpoint return 401 challenge to a request. ( in my example
jmeter test, the endpoint is http://httpbin.org/basic-auth/admin/admin123 )
3. Execute the attached example JMeter test case that sends a single request to
the server endpoint.
4. In the View Results Tree, select the sampler result tree node which
indicates an error.

Problem 1: On the Sampler result tab, notice that the sampler result indicates
something not helpful to end user. The following:

Response code:Non HTTP response code: java.lang.NullPointerException
Response message:Non HTTP response message: null

Expected: Response code should be 401 as that is what was actually returned by
the server.

Problem 2: on the Response data tab, Response headers tab, there are no
response headers from the 401 response.

Expected: there should be all the response headers that were returned by the
server.

Problem 3: Select the "Valid Response Codes" assertion node in the View Results
Tree. The "Assertion result" tab shows the following message:

Assertion error:false
Assertion failure:true
Assertion failure message:Test failed: code expected something using /

****** received  : [[[Non HTTP response code: java.lang.NullPointerException]]]

****** comparison: [[[200                                                   ]]]

Expected: Instead the "received" section should show the 401 status code


-----------------

Examining jmeter DEBUG logs we see the following stack trace at DEBUG level:

2021-06-07 09:13:35,074 DEBUG o.a.j.p.h.s.HTTPHC4Impl: RuntimeException
java.lang.NullPointerException: null
        at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizationForAuthScope(HTTPHC4Impl.java:252)
~[ApacheJMeter_http.jar:5.4.1]
        at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$ManagedCredentialsProvider.getCredentials(HTTPHC4Impl.java:233)
~[ApacheJMeter_http.jar:5.4.1]
        at
org.apache.http.impl.client.AuthenticationStrategyImpl.select(AuthenticationStrategyImpl.java:197)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.client.TargetAuthenticationStrategy.select(TargetAuthenticationStrategy.java:44)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.auth.HttpAuthenticator.handleAuthChallenge(HttpAuthenticator.java:151)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.execchain.MainClientExec.needAuthentication(MainClientExec.java:588)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:293)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
~[httpclient-4.5.12.jar:4.5.12]
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
~[httpclient-4.5.12.jar:4.5.12]
        at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:935)
~[ApacheJMeter_http.jar:5.4.1]
        at
org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:646)
[ApacheJMeter_http.jar:5.4.1]
        at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
[ApacheJMeter_http.jar:5.4.1]
        at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
[ApacheJMeter_http.jar:5.4.1]
        at
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
[ApacheJMeter_http.jar:5.4.1]
        at
org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)
[ApacheJMeter_core.jar:?]
        at
org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
[ApacheJMeter_core.jar:?]
        at
org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
[ApacheJMeter_core.jar:?]
        at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
[ApacheJMeter_core.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275]


Expected: Avoid the NullPointerException on no auth manager present to process
the server challenge. Instead propagate the actual response code returned by
the server.


This bug seems to have been introduced by the fix for bug 64267.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 65363] NullPointerException in HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizationForAuthScope when 401 response from remote and httpclient4.auth.preemptive=false

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65363

Felix Schumacher <fe...@internetallee.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk
             Status|NEW                         |NEEDINFO

--- Comment #1 from Felix Schumacher <fe...@internetallee.de> ---
Thanks for the detailed report and the test plan. I have added a guard to check
for the missing auth manager. It would be great, if you could test a build from
trunk and report back.

commit 975906ca28ece489706c2eeb5e4d6e1a125aa961
AuthorDate: Mon Jun 7 21:20:59 2021 +0200

    NullPointerException in
HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizationForAuthScope

    when 401 response from remote and httpclient4.auth.preemptive=false
    and no AuthManager is configured.

    Bugzilla Id: 65363
---
 .../java/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java     | 4 ++++
 xdocs/changes.xml                                                     | 1 +
 2 files changed, 5 insertions(+)

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 65363] NullPointerException in HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizationForAuthScope when 401 response from remote and httpclient4.auth.preemptive=false

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65363

Felix Schumacher <fe...@internetallee.de> changed:

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

--- Comment #2 from Felix Schumacher <fe...@internetallee.de> ---
Closing, as no feedback probably means, it works.

-- 
You are receiving this mail because:
You are the assignee for the bug.