[
https://issues.apache.org/jira/browse/NIFI-4040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16042347#comment-16042347
]
ASF GitHub Bot commented on NIFI-4040:
--------------------------------------
GitHub user ijokarumawak opened a pull request:
https://github.com/apache/nifi/pull/1898
NIFI-4040: Continue if SFTP failed getting user home directory
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number
you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target
branch (typically master)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via mvn
-Pcontrib-check clean install at the root nifi folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file, including the main
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main
NOTICE file found under nifi-assembly?
- [ ] If adding new Properties, have you added .displayName in addition to
.name (programmatic access) for each of the new properties?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in
which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check travis-ci for build
issues and submit an update to your PR as soon as possible.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ijokarumawak/nifi nifi-4040
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/1898.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1898
----
commit 2f5a1c1ae72eadae984fa9e3fcd2eb71daacfd95
Author: Koji Kawamura <[email protected]>
Date: 2017-06-08T07:10:09Z
NIFI-4040: Continue if SFTP failed getting user home directory
----
> ListSFTP fails to retrieve user home directory for certain user accounts
> ------------------------------------------------------------------------
>
> Key: NIFI-4040
> URL: https://issues.apache.org/jira/browse/NIFI-4040
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Reporter: Koji Kawamura
> Assignee: Koji Kawamura
>
> For some reason, when ListSFTP tries to get users home directory using
> com.jcraft.jsch.ChannelSftp.getHome() method, it fails with following error
> with certain user accounts:
> {code}
> 2017-04-05 11:33:37,645 ERROR [Timer-Driven Process Thread-20]
> o.a.nifi.processors.standard.ListSFTP
> java.io.IOException: Failed to obtain connection to remote host due to 2:
> File not found
> at
> org.apache.nifi.processors.standard.util.SFTPTransfer.getChannel(SFTPTransfer.java:447)
> ...
> Caused by: com.jcraft.jsch.SftpException: File not found
> at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
> ~[jsch-0.1.54.jar:na]
> at com.jcraft.jsch.ChannelSftp._realpath(ChannelSftp.java:2367)
> ~[jsch-0.1.54.jar:na]
> at com.jcraft.jsch.ChannelSftp.getHome(ChannelSftp.java:2437)
> ~[jsch-0.1.54.jar:na]
> at
> org.apache.nifi.processors.standard.util.SFTPTransfer.getChannel(SFTPTransfer.java:443)
> ~[nifi-standard-processors-1.1.0.2.1.1.0-2.jar:1.1.0.2.1.1.0-2]
> {code}
> This happens when the library sends SSH_FXP_REALPATH(16) with an empty
> string. Server returned SSH_FXP_STATUS(101). According [SSH File Transfer
> Protocol|https://tools.ietf.org/id/draft-ietf-secsh-filexfer-13.txt]
> specification, 101 means:
> {quote}
> The server MUST respond with SSH_FXP_STATUS(SSH_FX_OP_UNSUPPORTED) if it
> receives a packet it does not recognize.
> {quote}
> So, it indicates that client library sends a request packet that the server
> didn't understand. Since this error happens with certain user account, based
> on their home directly, there might be a combination that causes this issue.
> Although those user accounts fail with getHome method, they can list files if
> we don't call getHome(). (Confirmed by commenting out the getHome call)
> The home directory is used to address a relative 'Remote Path' to a full path
> by PutSFTP and PutFTP. The fullpath is only used for 'Transit URI' for their
> SEND provenance event.
> Summary:
> * There is no way to alter getHome method behavior from NiFi code base
> * Without getHome those user accounts can list the problematic FTP server
> * The value retrieved by getHome is only used for provenance event and it
> works without it
> From above observations, I propose to wrap getHome call with try/catch
> clause, and if it fails just log some message then continue.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)