Servlet not working correctly for some users

Hello,
In our custom JIRA (v. 7.3.6) plugin we have implemented integration with Google Calendars. Our basic use case is to authenticate with google and from that moment, when some issuetypes are created with date custom field and user is authenticated, then event is created in specific calendar. For almost everyone everything works fine, however some users can’t authenticate, because authentication servlet doesn’t work correctly. When these users try to authenticate they see only blank page, no logs in browser console and exception like this is thrown from JIRA:

2020-06-24 12:22:56,864 http-nio-8080-exec-19 ERROR      [o.a.c.c.C.[.[localhost].[/].[noopservlet]] Servlet.service() for servlet [noopservlet] in context with path [] threw exception
java.lang.RuntimeException: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
	at com.atlassian.plugin.cache.filecache.impl.StreamsCache.streamFromFile(StreamsCache.java:113)
	at com.atlassian.plugin.cache.filecache.impl.OneStreamCache.stream(OneStreamCache.java:54)
	at com.atlassian.plugin.cache.filecache.impl.FileCacheImpl.cache(FileCacheImpl.java:87)
	at com.atlassian.plugin.webresource.impl.http.Controller.sendCachedInProduction(Controller.java:319)
	at com.atlassian.plugin.webresource.impl.http.Controller.sendCached(Controller.java:282)
	at com.atlassian.plugin.webresource.impl.http.Controller.serveResources(Controller.java:222)
	at com.atlassian.plugin.webresource.impl.http.Controller.serveBatch(Controller.java:84)
	at com.atlassian.plugin.webresource.impl.http.Router$5.apply(Router.java:78)
	at com.atlassian.plugin.webresource.impl.http.Router$5.apply(Router.java:71)
	at com.atlassian.plugin.webresource.impl.support.http.BaseRouter.callHandler(BaseRouter.java:169)
	at com.atlassian.plugin.webresource.impl.support.http.BaseRouter.dispatch(BaseRouter.java:144)
	at com.atlassian.plugin.webresource.servlet.PluginResourceDownload.serveFile(PluginResourceDownload.java:65)
	at com.atlassian.plugin.servlet.AbstractFileServerServlet.doGet(AbstractFileServerServlet.java:28)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	... 48 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 39 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:80)
	... 1 filtered
	at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:78)
	... 20 filtered
	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
	... 12 filtered
	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
	... 7 filtered
	at com.atlassian.jira.plugin.webresource.CachingResourceDownloadRewriteRule$1.execute(CachingResourceDownloadRewriteRule.java:60)
	at org.tuckey.web.filters.urlrewrite.RewrittenUrlClass.doRewrite(RewrittenUrlClass.java:61)
	... 6 filtered
	at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
	... 5 filtered
	at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
	... 8 filtered
	at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
	... 4 filtered
	at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
	... 29 filtered
	at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
	... 29 filtered
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:380)
	at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:420)
	at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:345)
	at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:405)
	at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:393)
	at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
	at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
	at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:145)
	at com.atlassian.gzipfilter.GzipResponseStream.write(GzipResponseStream.java:46)
	at com.atlassian.gzipfilter.RoutableServletOutputStream.write(RoutableServletOutputStream.java:134)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1384)
	at com.atlassian.plugin.cache.filecache.impl.StreamsCache.streamFromFile(StreamsCache.java:110)
	... 238 more
Caused by: java.io.IOException: Broken pipe
	at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
	at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
	at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
	at sun.nio.ch.IOUtil.write(IOUtil.java:65)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
	... 10 filtered
	... 250 more
2020-06-24 12:23:00,211 http-nio-8080-exec-23 ERROR username /plugins/servlet/calendarAuth2 [c.x.j.p.r.g.calendar.auth.CalendarAuthServlet] message from CalendarAuthServlet doGet().

For authentication we have two servlets as in Google developers tutorial, on issue view we have simple <a> tag which targets to calendar auth servlet URL and it is mapped in atlassian-plugin.xml

What may be the cause of this issue?

I know BrokenPipe errors usually when clients interrupt a connection midway. I would check the browser console on the people where it does not work. Might be a client/browser side issue such as a CORS thing or HTST browser security thing. I wish you luck, but the stacktrace shows no other real server side reason.
If you use a proxy in front of Jira maybe that proxy interrupts the connection somehow. Maybe the connection pool is full or any other proxy related thing.

We found workaround - to create proper google authentication url manually (because callback servlet works and saves needed information), and because issue occurs only for few people, we’ve stopped trying to fix the error.