Skip to content
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

Pass string to ObjectMapper instead of InputStream #531

Merged
merged 1 commit into from
Jul 12, 2023
Merged

Conversation

vinokurig
Copy link
Contributor

What does this PR do?

Pass string to ObjectMapper instead of InputStream in order to avoid No content to map due to end-of-input error caused by jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.
An error was discovered in our customers environment:

2023-07-07 11:31:31,713[nio-8080-exec-2]  [ERROR] [o.e.c.a.f.s.g.GithubApiClient 117]   - Error while parsing response body
com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
 at [Source: (jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream); line: 1, column: 0]
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4821)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4723)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3714)
	at org.eclipse.che.api.factory.server.github.GithubApiClient.lambda$getUser$0(GithubApiClient.java:115)
	at org.eclipse.che.api.factory.server.github.GithubApiClient.executeRequest(GithubApiClient.java:260)
	at org.eclipse.che.api.factory.server.github.GithubApiClient.getUser(GithubApiClient.java:109)
	at org.eclipse.che.api.factory.server.github.GithubPersonalAccessTokenFetcher.isValid(GithubPersonalAccessTokenFetcher.java:214)
	at org.eclipse.che.api.factory.server.scm.ScmPersonalAccessTokenFetcher.isValid(ScmPersonalAccessTokenFetcher.java:65)
	at org.eclipse.che.api.factory.server.scm.kubernetes.KubernetesPersonalAccessTokenManager.doGetPersonalAccessToken(KubernetesPersonalAccessTokenManager.java:187)
	at org.eclipse.che.api.factory.server.scm.kubernetes.KubernetesPersonalAccessTokenManager.get(KubernetesPersonalAccessTokenManager.java:152)
	at jdk.internal.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.google.inject.internal.DelegatingInvocationHandler.invoke(DelegatingInvocationHandler.java:50)
	at com.sun.proxy.$Proxy101.get(Unknown Source)
	at org.eclipse.che.api.factory.server.scm.AbstractGitUserDataFetcher.fetchGitUserData(AbstractGitUserDataFetcher.java:59)
	at org.eclipse.che.workspace.infrastructure.kubernetes.namespace.configurator.GitconfigUserDataConfigurator.configure(GitconfigUserDataConfigurator.java:57)
	at org.eclipse.che.workspace.infrastructure.kubernetes.namespace.KubernetesNamespaceFactory.configureNamespace(KubernetesNamespaceFactory.java:534)
	at org.eclipse.che.workspace.infrastructure.openshift.project.OpenShiftProjectFactory.getOrCreate(OpenShiftProjectFactory.java:120)
	at org.eclipse.che.workspace.infrastructure.openshift.project.OpenShiftProjectFactory.getOrCreate(OpenShiftProjectFactory.java:58)
	at org.eclipse.che.workspace.infrastructure.kubernetes.provision.NamespaceProvisioner.provision(NamespaceProvisioner.java:42)
	at org.eclipse.che.workspace.infrastructure.kubernetes.api.server.KubernetesNamespaceService.provision(KubernetesNamespaceService.java:95)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.everrest.core.impl.method.DefaultMethodInvoker.invokeMethod(DefaultMethodInvoker.java:174)
	at org.everrest.core.impl.method.DefaultMethodInvoker.invokeMethod(DefaultMethodInvoker.java:61)
	at org.everrest.core.impl.RequestDispatcher.doInvokeResource(RequestDispatcher.java:329)
	at org.everrest.core.impl.RequestDispatcher.invokeSubResourceMethod(RequestDispatcher.java:319)
	at org.everrest.core.impl.RequestDispatcher.dispatch(RequestDispatcher.java:257)
	at org.everrest.core.impl.RequestDispatcher.dispatch(RequestDispatcher.java:131)
	at org.everrest.core.impl.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:61)
	at org.everrest.core.impl.EverrestProcessor.process(EverrestProcessor.java:130)
	at org.everrest.core.servlet.EverrestServlet.service(EverrestServlet.java:62)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:631)
	at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:290)
	at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:280)
	at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:184)
	at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:89)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85)
	at org.eclipse.che.core.metrics.ApiResponseMetricFilter.doFilter(ApiResponseMetricFilter.java:46)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.eclipse.che.multiuser.api.authentication.commons.filter.MultiUserEnvironmentInitializationFilter.doFilter(MultiUserEnvironmentInitializationFilter.java:161)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at org.eclipse.che.commons.logback.filter.RequestIdLoggerFilter.doFilter(RequestIdLoggerFilter.java:50)
	at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82)
	at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:121)
	at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:133)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:166)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:738)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:676)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:400)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:894)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:829)
2023-07-07 11:31:31,713[nio-8080-exec-2]  [ERROR] [o.e.c.a.f.s.g.GithubApiClient 118]   - Error while parsing response body No content to map due to end-of-input
 at [Source: (jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream); line: 1, column: 0]

Screenshot/screencast of this PR

What issues does this PR fix or reference?

https://issues.redhat.com/browse/CRW-4551

How to test this PR?

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Signed-off-by: Igor Vinokur <ivinokur@redhat.com>
Copy link
Member

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vinokurig can we add some tests for the fix?

@vinokurig
Copy link
Contributor Author

@ibuziuk This is already covered with tests. The issue is that we can not reproduce the error in our known environment.

@ibuziuk
Copy link
Member

ibuziuk commented Jul 11, 2023

@artaleks9 could you please take a look why ci/prow/v12-github-with-pat-setup-flow is failing?

@tolusha
Copy link
Contributor

tolusha commented Jul 11, 2023

/retest

@tolusha
Copy link
Contributor

tolusha commented Jul 11, 2023

Can we be sure that this does not affect the current behavior?

@vinokurig
Copy link
Contributor Author

vinokurig commented Jul 11, 2023

@tolusha

Can we be sure that this does not affect the current behavior?

I have tested this with GitHub flow, all API clients are covered with tests.

@openshift-ci
Copy link

openshift-ci bot commented Jul 12, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ibuziuk, tolusha, vinokurig

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vinokurig vinokurig merged commit c5963e0 into main Jul 12, 2023
4 checks passed
@vinokurig vinokurig deleted the CRW-4551 branch July 12, 2023 07:33
vinokurig added a commit that referenced this pull request Jul 12, 2023
Pass string to ObjectMapper instead of InputStream in order to avoid No content to map due to end-of-input error caused by jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.
An error was discovered in our customers environment
vinokurig added a commit that referenced this pull request Jul 12, 2023
Pass string to ObjectMapper instead of InputStream in order to avoid No content to map due to end-of-input error caused by jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.
An error was discovered in our customers environment
@devstudio-release
Copy link

Build 3.9 :: server_3.x/185: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.9 :: server_3.x/185: SUCCESS

Upstream sync done; /DS_CI/sync-to-downstream_3.x/3769 triggered

@devstudio-release
Copy link

Build 3.9 :: update-digests_3.x/3681: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.9 :: server_3.x/186: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.9 :: server_3.x/187: Console, Changes, Git Data

@devstudio-release
Copy link

@devstudio-release
Copy link

@devstudio-release
Copy link

Build 3.9 :: get-sources-rhpkg-container-build_3.x/3656: FAILURE

server : 3.x :: Failed in 54128420 : BREW:BUILD/STATUS:UNKNOWN
FAILURE:; copied to quay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants