[ 
https://issues.apache.org/jira/browse/NIFI-12837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17827002#comment-17827002
 ] 

Anders edited comment on NIFI-12837 at 3/14/24 9:15 AM:
--------------------------------------------------------

Thank you for replying Peter!

Even if the DFS feature would be somewhat experimental, it would still be very 
useful for those able to utilize ut.
Without it, I (and possibly others) can't use the SMB processors at all.

I've just patched in support for it in the PutSmbFile processor I am running, 
but I'm no java coder, and it's not pretty.

I guess I might also be running into the first issue you are mentioning. After 
some time (not necessarily long), I end up getting 
{code}
ERROR [Timer-Driven Process Thread-X] o.apache.nifi.processors.smb.PutSmbFile 
PutSmbFile[id=...] Could not establish smb connection because of error 
com.hierynomus.smbj.common.SMBRuntimeException: 
com.hierynomus.protocol.transport.TransportException:  
java.net.SocketException: Broken pipe (Write failed)
{code}

I thought the PutSmbFile processor cleans up connections when it's done with 
the running thread and reconnects on the nest run (@onTrigger based on 
schedule), but it is permanently sad until I stop the processor and start it 
again. (probably just me not understanding java)

As a side note that may or may not be related. I've noticed that the "Temporary 
Suffix" option in PutSmbFile does not work for me when I've enbled DFS and talk 
to the DFS-address. It gives me STATUS_OBJECT_NOT_FOUND when it tries to rename 
the file (it is uploaded successfully to the share with the suffix though). It 
works if I talk directly to the nodes in the cluster though.

Either way, adding the DFS option as a toggle (default false) and adding the 
workaround you mention for stale connections would be extremely useful.


was (Author: andersns):
Thank you for replying Peter!

Even if the DFS feature would be somewhat experimental, it would still be very 
useful for those able to utilize ut.
Without it, I (and possibly others) can't use the SMB processors at all.

I've just patched in support for it in the PutSmbFile processor I am running, 
but I'm no java coder, and it's not pretty.

I guess I might also be running into the first issue you are mentioning. After 
some time (not necessarily long), I end up getting 
{code}
ERROR [Timer-Driven Process Thread-X] o.apache.nifi.processors.smb.PutSmbFile 
PutSmbFile[id=...] Could not establish smb connection because of error 
com.hierynomus.smbj.common.SMBRuntimeException: 
com.hierynomus.protocol.transport.TransportException:  
java.net.SocketException: Broken pipe (Write failed)
{code}

I've also noticed that the "Temporary Suffix" option in PutSmbFile does not 
work for me when I've enbled DFS and talk to the DFS-address. It gives me 
STATUS_OBJECT_NOT_FOUND. I works if I talk directly to the nodes in the cluster 
though.

Either way, adding the DFS options as a toggle (default false) and adding the 
workaround you mention would be extremely useful.

> Add DFS setting to smb processors
> ---------------------------------
>
>                 Key: NIFI-12837
>                 URL: https://issues.apache.org/jira/browse/NIFI-12837
>             Project: Apache NiFi
>          Issue Type: Improvement
>    Affects Versions: 1.25.0
>            Reporter: Anders
>            Assignee: Peter Turcsanyi
>            Priority: Major
>
> The hierynomus/smbj library has a setting for enabling DFS which is disabled 
> by default:
> https://github.com/hierynomus/smbj/blob/f25d5c5478a5b73e9ba4202dcfb365974e15367e/src/main/java/com/hierynomus/smbj/SmbConfig.java#L106C17-L106C39
> This appears to cause problems in some SMB configurations.
> Patched 
> https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
>  to test in my environment with:
> {code}
> $ git diff 
> nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> diff --git 
> a/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
>  
> b/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> index 0895abfae0..aaaaeac765 100644
> --- 
> a/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> +++ 
> b/nifi-nar-bundles/nifi-smb-bundle/nifi-smb-smbj-common/src/main/java/org/apache/nifi/smb/common/SmbUtils.java
> @@ -46,6 +46,8 @@ public final class SmbUtils {
>              }
>          }
> +        configBuilder.withDfsEnabled(true);
> +
>          if (context.getProperty(USE_ENCRYPTION).isSet()) {
>              
> configBuilder.withEncryptData(context.getProperty(USE_ENCRYPTION).asBoolean());
>          }
> {code}
> This appeared to resolve the issue.
> It would be very useful if this setting was available to toggle in the UI for 
> all SMB processors.
> Without this setting, I get a *STATUS_PATH_NOT_COVERED* error. 
> Somewhat related hierynomus/smbj github issues:
> https://github.com/hierynomus/smbj/issues/152
> https://github.com/hierynomus/smbj/issues/419
> This setting should be made available in the following processors and 
> services:
> * GetSmbFile
> * PutSmbFile
> * SmbjClientProviderService
> Edit: It might require some more changes to handle the connections and 
> sessions correctly.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to