embulk / embulk-output-sftp

Store files on remote server using SFTP
Apache License 2.0
5 stars 5 forks source link

jsch jar seems unstable #28

Open sonots opened 7 years ago

sonots commented 7 years ago

We often encountered sftp errors (of course, host ipaddress and password is correct, but we see failed to connect sftp server) as

failed to connect sftp server: Could not connect to SFTP server at ¥"sftp://user@xxx.xxx.xxx/¥".
org.apache.commons.vfs2.FileSystemException:Could not connect to SFTP server at ¥"sftp://user@xxx.xxx.xxx.xxx/¥".
    atorg.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:108)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:117)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:85)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:69)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:790)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:712)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.embulk.output.sftp.SftpFileOutput.newSftpFile(SftpFileOutput.java:212)[embulk-output-sftp-0.0.4.jar:na]
    at org.embulk.output.sftp.SftpFileOutput.nextFile(SftpFileOutput.java:116)[embulk-output-sftp-0.0.4.jar:na]
    at org.embulk.spi.util.FileOutputOutputStream.nextFile(FileOutputOutputStream.java:34)[embulk:0.8.6]
    at org.embulk.encoder.CommonsCompressArchiveProvider.openNext(CommonsCompressArchiveProvider.java:65)[embulk-encoder-commons-compress-0.1.0.jar:na]
    at org.embulk.spi.util.OutputStreamFileOutput.nextFile(OutputStreamFileOutput.java:34)[embulk:0.8.6]
    at org.embulk.spi.util.FileOutputOutputStream.nextFile(FileOutputOutputStream.java:34)[embulk:0.8.6]
    at org.embulk.spi.util.LineEncoder.nextFile(LineEncoder.java:93)[embulk:0.8.6]
    at org.embulk.standards.CsvFormatterPlugin.open(CsvFormatterPlugin.java:116)[embulk:0.8.6]
    at org.embulk.spi.FileOutputRunner.open(FileOutputRunner.java:140)[embulk:0.8.6]
    at org.embulk.spi.util.Executors.process(Executors.java:56)[embulk:0.8.6]
    at org.embulk.spi.util.Executors.process(Executors.java:42)[embulk:0.8.6]
    at org.embulk.exec.LocalExecutorPlugin$DirectExecutor$1.call(LocalExecutorPlugin.java:184)[embulk:0.8.6]
    at org.embulk.exec.LocalExecutorPlugin$DirectExecutor$1.call(LocalExecutorPlugin.java:180)[embulk:0.8.6]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[na:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[na:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[na:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Causedby: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTPserver at ¥"xxx.xxx.xxx.xxx¥".
    at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:170)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:97)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    ... 22 common frames omitted
Causedby: com.jcraft.jsch.JSchException: Auth fail
    at com.jcraft.jsch.Session.connect(Session.java:512)‾[jsch-0.1.53.jar:na]
    at com.jcraft.jsch.Session.connect(Session.java:183)‾[jsch-0.1.53.jar:na]
    at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:166)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    ... 23 common frames omitted
2016-03-1601:10:37.311 +0000 [WARN] (0016:task-0000): sleep in next connection retry:2000 milliseconds
2016-03-16 01:10:39.311 +0000 [WARN] (0016:task-0000):retry to connect sftp server: 1 times
2016-03-16 01:10:40.598 +0000 [WARN](0016:task-0000): failed to connect sftp server: Could not connect to SFTPserver at ¥"sftp://user@xxx.xxx.xxx.xxx/¥".
org.apache.commons.vfs2.FileSystemException:Could not connect to SFTP server at ¥"sftp://user@xxx.xxx.xxx.xxx/¥".
    atorg.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:108)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:117)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:85)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:69)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:790)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:712)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.embulk.output.sftp.SftpFileOutput.newSftpFile(SftpFileOutput.java:212)[embulk-output-sftp-0.0.4.jar:na]
    at org.embulk.output.sftp.SftpFileOutput.nextFile(SftpFileOutput.java:116)[embulk-output-sftp-0.0.4.jar:na]
    at org.embulk.spi.util.FileOutputOutputStream.nextFile(FileOutputOutputStream.java:34)[embulk:0.8.6]
    at org.embulk.encoder.CommonsCompressArchiveProvider.openNext(CommonsCompressArchiveProvider.java:65)[embulk-encoder-commons-compress-0.1.0.jar:na]
    at org.embulk.spi.util.OutputStreamFileOutput.nextFile(OutputStreamFileOutput.java:34)[embulk:0.8.6]
    at org.embulk.spi.util.FileOutputOutputStream.nextFile(FileOutputOutputStream.java:34)[embulk:0.8.6]
    at org.embulk.spi.util.LineEncoder.nextFile(LineEncoder.java:93)[embulk:0.8.6]
    at org.embulk.standards.CsvFormatterPlugin.open(CsvFormatterPlugin.java:116)[embulk:0.8.6]
    at org.embulk.spi.FileOutputRunner.open(FileOutputRunner.java:140)[embulk:0.8.6]
    at org.embulk.spi.util.Executors.process(Executors.java:56)[embulk:0.8.6]
    at org.embulk.spi.util.Executors.process(Executors.java:42)[embulk:0.8.6]
    at org.embulk.exec.LocalExecutorPlugin$DirectExecutor$1.call(LocalExecutorPlugin.java:184)[embulk:0.8.6]
    at org.embulk.exec.LocalExecutorPlugin$DirectExecutor$1.call(LocalExecutorPlugin.java:180)[embulk:0.8.6]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[na:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[na:1.7.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[na:1.7.0_45]
    at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Causedby: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTPserver at ¥"xxx.xxx.xxx.xxx¥".
    at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:170)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:97)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    ... 22 common frames omitted
Causedby: com.jcraft.jsch.JSchException: Auth fail
    at com.jcraft.jsch.Session.connect(Session.java:512)‾[jsch-0.1.53.jar:na]
    at com.jcraft.jsch.Session.connect(Session.java:183)‾[jsch-0.1.53.jar:na]
    at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:166)‾[commons-vfs2-2.1.1660580.2.jar:2.1.1660580.2]
    ... 23 common frames omitted
2016-03-1601:10:40.599 +0000 [WARN] (0016:task-0000): sleep in next connection retry:4000 milliseconds
2016-03-16 01:10:44.599 +0000 [WARN] (0016:task-0000):retry to connect sftp server: 2 times
2016-03-16 01:10:45.513 +0000 [INFO](0016:task-0000): new sftp file: sftp://user@xxx.xxx.xxx.xxx/Import/_00_20160316000000-20160316010000.zip
2016-03-1601:10:51.133 +0000 [ERROR] (0016:task-0000): Could not close the output streamfor file ¥"sftp://user@xxx.xxx.xxx.xxx/Import/_00_20160316000000-20160316010000.zip¥".
2016-03-1601:10:51.135 +0000 [INFO] (0001:transaction): {done:  1 / 1, running: 0}
org.embulk.exec.PartialExecutionException:java.lang.RuntimeException: org.apache.commons.vfs2.FileSystemException: Couldnot close the output stream for file ¥"sftp://user@xxx.xxx.xxx.xxx/Import/_00_20160316000000-20160316010000.zip¥".
    atorg.embulk.exec.BulkLoader$LoaderState.buildPartialExecuteException(org/embulk/exec/BulkLoader.java:363)
    atorg.embulk.exec.BulkLoader.doRun(org/embulk/exec/BulkLoader.java:572)
    atorg.embulk.exec.BulkLoader.access$000(org/embulk/exec/BulkLoader.java:33)
    atorg.embulk.exec.BulkLoader$1.run(org/embulk/exec/BulkLoader.java:374)
    atorg.embulk.exec.BulkLoader$1.run(org/embulk/exec/BulkLoader.java:370)
    atorg.embulk.spi.Exec.doWith(org/embulk/spi/Exec.java:25)
    at org.embulk.exec.BulkLoader.run(org/embulk/exec/BulkLoader.java:370)
    atorg.embulk.EmbulkEmbed.run(org/embulk/EmbulkEmbed.java:180)
    at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:606)
    atRUBY.run(uri:classloader:/embulk/runner.rb:84)
    at RUBY.run(uri:classloader:/embulk/command/embulk_run.rb:306)
    atRUBY.<top>(uri:classloader:/embulk/command/embulk_main.rb:2)
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:937)
    atusr.foo.home.user.embulk_minus_analytics_minus_wrapper.bin.embulk.embulk.command.embulk_bundle.<top>(file:/usr/foo/home/user/embulk-analytics-wrapper/bin/embulk!/embulk/command/embulk_bundle.rb:30)
    atjava.lang.invoke.MethodHandle.invokeWithArguments(java/lang/invoke/MethodHandle.java:599)
    atorg.embulk.cli.Main.main(org/embulk/cli/Main.java:23)
Caused by: java.lang.RuntimeException:org.apache.commons.vfs2.FileSystemException: Could not close the output streamfor file ¥"sftp://user@xxx.xxx.xxx.xxx/Import/_00_20160316000000-20160316010000.zip¥".
    atcom.google.common.base.Throwables.propagate(Throwables.java:160)
    at org.embulk.output.sftp.SftpFileOutput.closeCurrentFile(SftpFileOutput.java:181)
    atorg.embulk.output.sftp.SftpFileOutput.close(SftpFileOutput.java:152)
    atorg.embulk.encoder.CommonsCompressArchiveProvider.close(CommonsCompressArchiveProvider.java:90)
    atorg.embulk.spi.util.OutputStreamFileOutput.close(OutputStreamFileOutput.java:70)
    atorg.embulk.spi.util.LineEncoder.close(LineEncoder.java:117)
    at org.embulk.standards.CsvFormatterPlugin$1.close(CsvFormatterPlugin.java:222)
    atorg.embulk.spi.FileOutputRunner$DelegateTransactionalPageOutput.close(FileOutputRunner.java:178)
    atorg.embulk.spi.PageBuilder.close(PageBuilder.java:255)
    at org.embulk.filter.expand_json.FilteredPageOutput.close(FilteredPageOutput.java:228)
    atorg.embulk.spi.PageBuilder.close(PageBuilder.java:255)
    at org.embulk.standards.CsvParserPlugin.run(CsvParserPlugin.java:394)
    atorg.embulk.spi.FileInputRunner.run(FileInputRunner.java:154)
    at org.embulk.spi.util.Executors.process(Executors.java:67)
    atorg.embulk.spi.util.Executors.process(Executors.java:42)
    at org.embulk.exec.LocalExecutorPlugin$DirectExecutor$1.call(LocalExecutorPlugin.java:184)
    atorg.embulk.exec.LocalExecutorPlugin$DirectExecutor$1.call(LocalExecutorPlugin.java:180)
    atjava.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    atjava.lang.Thread.run(Thread.java:744)
Caused by: org.apache.commons.vfs2.FileSystemException:Could not close the output stream for f
sonots commented 7 years ago

Finally, we (including the original author) decided to use sftp command, then our system became stable.