timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-31015] Failure when downloading zipped artifacts #7574

Closed timja closed 8 years ago

timja commented 8 years ago

While downloading artifacts in zip (whole folder) error appears:

java.nio.file.InvalidPathException: Illegal char <*> at index 73: C:\Program Files (x86)\Jenkins\jobs\Project-Default\builds\1677\archive\*zip*
    at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
    at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at sun.nio.fs.WindowsPath.parse(Unknown Source)
    at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
    at java.io.File.toPath(Unknown Source)
    at jenkins.util.VirtualFile$FileVF.isIllegalSymlink(VirtualFile.java:301)
    at jenkins.util.VirtualFile$FileVF.exists(VirtualFile.java:247)
    at hudson.model.DirectoryBrowserSupport.serveFile(DirectoryBrowserSupport.java:186)
    at hudson.model.DirectoryBrowserSupport.generateResponse(DirectoryBrowserSupport.java:124)
    at org.kohsuke.stapler.HttpResponseRenderer$Default.handleHttpResponse(HttpResponseRenderer.java:124)
    at org.kohsuke.stapler.HttpResponseRenderer$Default.generateResponse(HttpResponseRenderer.java:69)
    at org.kohsuke.stapler.Function.renderResponse(Function.java:113)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:98)
    at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:211)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
    at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:46)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
    at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:85)
    at org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:99)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
    at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:58)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:123)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:949)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1011)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SslConnection.handle(SslConnection.java:196)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Originally reported by gaku, imported from: Failure when downloading zipped artifacts
  • assignee: danielbeck
  • status: Closed
  • priority: Critical
  • resolution: Fixed
  • resolved: 2015-11-30T08:58:34+00:00
  • imported: 2022/01/10
timja commented 8 years ago

danielbeck:

What happens when you use patterns containing "?" or "*" in the search/filter box of the artifact/workspace browser? Do those fail as well?

timja commented 8 years ago

gaku:

In workspace browser I can "pack" files to zip clicking ("All files in zip") and patterns works.
In artifact browser I cannot pack files to zip, and pattern *.csproj returns error but ?.csproj return all files and folders. No error. Don't know if this is right behaviour.

timja commented 8 years ago

danielbeck:

gaku Would you be willing to test a custom build of Jenkins? I don't have a Windows machine around at the moment.

timja commented 8 years ago

gaku:

Yep. I can deploy it on our test jenkins and check you custom build.

timja commented 8 years ago

danielbeck:

Pull request: https://github.com/jenkinsci/jenkins/pull/1875

PR build: https://jenkins.ci.cloudbees.com/job/core/job/jenkins-core/3387/ – download the war created there. There have been no notable changes to the master branch since 1.634 was released, so that should be safe enough to try.

timja commented 8 years ago

trinition:

I see Daniel's pull request simply swallows the exception thrown from deeper. Why is the exception now being thrown from deeper? The most recent commit I can see that could've caused this is:

https://github.com/jenkinsci/jenkins/commit/16883377dff9ad3f48e9fe6404af1e9cf2c9dbbf#diff-f0533b503b7642d02496e8542eecfdd3

timja commented 8 years ago

danielbeck:

It's possible we could change that part to not throw, I opted for the lower impact approach here – I doubt we'll be handling made up paths a lot.

timja commented 8 years ago

gaku:

danielbeck your build solved bug with archiving artifacts but there still is a problem with Search of artifacts.

*Copy*

works in workspace, but it doesn't work in artifacts.

timja commented 8 years ago

trinition:

I guess my concern is what was the intent of "VirtualFile$FileVF.isIllegalSymlink" or "VirtualFile$FileVF.exists"? Those return bool. Would an illegal file path "not exist" (return false), or throw an exception as it does now? Because if the deeper code instead catches the platform-specific exception and return false, then none of the shallower code needs to change.

DISCLAIMER: I may not know what I'm talking about.

timja commented 8 years ago

dzolee:

I observed the same issue after upgrading to 1.634 (on Win2012 x64). I had to rollback to 1.633 as the test framework depends on downloading the whole artifact pack as ZIP.
1.633 works fine.

timja commented 8 years ago

tonka:

I have the same issue (Win 2008 R2 x64)

timja commented 8 years ago

agavrilov:

I have the same issue when trying to view build artifacts (clicking on 'view' link). The error is

java.nio.file.InvalidPathException: Illegal char <*> at index 87: D:\Jenkins\jobs\C8-develop-unit-tests-oracle\builds\1061\archive\Log\C8\pi_centric.log\*view* 

with the same stack trace as reported. Jenkins version is 1.635 (Win 2008 R2 x64).

timja commented 8 years ago

nkjensen:

Issue confirmed on Windows 7 and Jenkins 1.634 and Jenkins 1.635.

Jenkins 1.631 on windows 7 does not have this issue.

java.nio.file.InvalidPathException: Illegal char <> at index 53: D:\Jenkins\jobs\ME-1312-3-BaseTest\builds\12\archive*zip

occurs when the link :

http://ldc1-server-1:8080/view/ME/job/ME-1312-3-BaseTest/lastSuccessfulBuild/artifact/*zip*/archive.zip
(or with FQDN)
http://ldc1-server-1.md-man.biz:8080/view/ME/job/ME-1312-3-BaseTest/lastSuccessfulBuild/artifact/*zip*/archive.zip

was clicked (none of the servers are publicly accessible).

timja commented 8 years ago

hgeerligs:

Issue confirmed on on Windows 7 and Jenkins 1.636

timja commented 8 years ago

helge_h22:

Issue confirmed on Windows Server 2012R2 and Jenkins 1.636

timja commented 8 years ago

gaku:

What is stoping this fix from going to release version? Just as a reminder, this is big problem for lots of people.

timja commented 8 years ago

trinition:

I think that's stopping it is questions from Oct 19 about whether it's the right fix, and comments on Oct 20 indicating that this fix doesn't fix all paths.

timja commented 8 years ago

danielbeck:

I plan to take a look later this week, so this gets into next week's release if all goes well.

timja commented 8 years ago

gaku:

Thank you.

timja commented 8 years ago

dzolee:

I like the weekly updates but in the production environment I will switch to the LTS release line. Keep up the good work.

timja commented 8 years ago

danielbeck:

Updated the PR @ https://github.com/jenkinsci/jenkins/pull/1875 to catch the exception at the source.

I guess I'll need to set up a Windows VM here to test the observation by agavrilov? Or anyone else willing to test this build?

timja commented 8 years ago

har:

Maybe it's possible to resolve JENKINS-9146 in the course of this task too?

timja commented 8 years ago

danielbeck:

har Completely unrelated issue.

timja commented 8 years ago

nkjensen:

I can test a new release. I would need a link to the new jenkins.war file for download.

timja commented 8 years ago

danielbeck:

nkjensen Thanks. I was busy with the security update for the last week, so I made no progress here. I restarted the PR build, war will be downloadable from https://jenkins.ci.cloudbees.com/job/core/job/jenkins-core/3503/ once the build is complete.

timja commented 8 years ago

nkjensen:

The fix works fine here, thank you Daniel.

timja commented 8 years ago

danielbeck:

nkjensen Could you confirm it also fixes pattern-based workspace browsing/filtering (gaku's comment), and viewing files plainly (agavrilov)?

timja commented 8 years ago

nkjensen:

About Jakub Gawlas's comment: I tried this pattern:
*.cmd
in a directory in the workspace. It worked fine.

I tried cmd* too and it returns a 404 since nothing matches. I guess that is correct behaviour?

About Alexander Gavrilov's comment:
I tried to browse into a directory in our artifacts tree and "view" a regular file as text (clicking "view" in the right side of the line), it also worked.

Clicking the filename itself downloads the file (no regression).

BR. NKJ

timja commented 8 years ago

scm_issue_link:

Code changed in jenkins
User: Daniel Beck
Path:
core/src/main/java/jenkins/util/VirtualFile.java
http://jenkins-ci.org/commit/jenkins/3450b52a8ac90c357fb96a67c58eaf2b8e68d01c
Log:
[FIX JENKINS-31015] Prevent InvalidPathException in FileVF

timja commented 8 years ago

scm_issue_link:

Code changed in jenkins
User: Daniel Beck
Path:
core/src/main/java/jenkins/util/VirtualFile.java
http://jenkins-ci.org/commit/jenkins/eeff84aff3ffb6499a0f4060a39f1182e400bb9a
Log:
Merge pull request #1875 from daniel-beck/JENKINS-31015

[FIX JENKINS-31015] Prevent InvalidPathException in FileVF

Compare: https://github.com/jenkinsci/jenkins/compare/286475f9abc1...eeff84aff3ff

timja commented 8 years ago

dogfood:

Integrated in jenkins_main_trunk #4364
[FIX JENKINS-31015] Prevent InvalidPathException in FileVF (Revision 3450b52a8ac90c357fb96a67c58eaf2b8e68d01c)

Result = UNSTABLE
daniel-beck : 3450b52a8ac90c357fb96a67c58eaf2b8e68d01c
Files :

timja commented 8 years ago

14163314:

Jenkins ver. 1.638
Windows 7 x86
Java: jre1.8.0_66

The problem is still exists in ver.1.638.

java.nio.file.InvalidPathException: Illegal char <> at index 72: C:\Program Files\Jenkins\jobs\project_name\builds\118\archive*zip
at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
at sun.nio.fs.WindowsPath.parse(Unknown Source)
at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
at java.io.File.toPath(Unknown Source)

timja commented 8 years ago

danielbeck:

Just compare the date the fix was merged to the release date of 1.638.

IOW, fixed towards 1.639.

timja commented 8 years ago

geraldkern:

any info on when this fix will be available for download?

timja commented 8 years ago

ajstimer:

Does anyone know the release date of 1.639? 11/29/15?

timja commented 8 years ago

14163314:

The new version 1.639 is available, but on Jenkins (windows) I don`t see this new version via Jenkins web.
Here is the link with available 1.639 version:
http://updates.jenkins-ci.org/download/war/1.639/jenkins.war

timja commented 8 years ago

14163314:

I don`t understand what happens, but after reopen this ticket, I saw the new version on Jenkins.
Sorry for inconvenience.

timja commented 7 years ago

nkjensen:

The problem has been fixed at least since 2.61

timja commented 2 years ago

[Originally duplicated by: JENKINS-31434]

timja commented 2 years ago

[Originally duplicated by: JENKINS-31226]

timja commented 2 years ago

[Originally related to: JENKINS-31682]