wso2 / micro-integrator

The cloud-native configuration driven runtime that helps developers implement composite microservices.

Home Page:https://wso2.com/integration/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[MI-4.2.0] File move fails when file read location is a bind mount volume

tdkmalan90 opened this issue · comments

When MI runs as a docker container with bind mount volume as the file read location for the VFS listener proxy. This proxy service is able to read the file but if we set the ActionAfterProcess to MOVE, MI fails to move the file after processing and we could observe the below error.

[2024-04-03 03:11:04,785] ERROR {VFSTransportListener} - [Service: TestProxy] - Error moving file : file:///home/wso2carbon/in/apim-seq.xml to file:///home/wso2carbon/tmp/archive?transport.vfs.AvoidPermissionCheck=true org.apache.commons.vfs2.FileSystemException: Could not rename "file:///home/wso2carbon/in/apim-seq.xml" to "file:///home/wso2carbon/tmp/archive/apim-seq.xml".
at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1615)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:751)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:517)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:133)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not rename file "/home/wso2carbon/in/apim-seq.xml" to "file:///home/wso2carbon/tmp/archive/apim-seq.xml".
at org.apache.commons.vfs2.provider.local.LocalFile.doRename(LocalFile.java:131)
at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1606)
... 9 more

[2024-04-03 03:11:04,791] ERROR {VFSTransportListener} - File object 'file:///home/wso2carbon/in/apim-seq.xml'cloud not be moved, will remain in "locked" state org.apache.axis2.AxisFault: Error moving file : file:///home/wso2carbon/in/apim-seq.xml to file:///home/wso2carbon/tmp/archive?transport.vfs.AvoidPermissionCheck=true
at org.apache.synapse.transport.vfs.VFSTransportErrorHandler.handleException(VFSTransportErrorHandler.java:130)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:756)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:517)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:133)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not rename "file:///home/wso2carbon/in/apim-seq.xml" to "file:///home/wso2carbon/tmp/archive/apim-seq.xml".
at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1615)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:751)
... 8 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not rename file "/home/wso2carbon/in/apim-seq.xml" to "file:///home/wso2carbon/tmp/archive/apim-seq.xml".
at org.apache.commons.vfs2.provider.local.LocalFile.doRename(LocalFile.java:131)
at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1606)
... 9 more
Steps to reproduce

Use the command "docker run -d -v Absolute-file-path/IN:/home/wso2carbon/in docker.wso2.com/wso2mi:4.2.0.63"
Deploy the below proxy to MI server using command "docker cp TestProxy.xml [container-id]:/home/wso2carbon/wso2mi-4.2.0/repository/deployment/server/synapse-configs/default/proxy-services"

<proxy xmlns="http://ws.apache.org/ns/synapse" name="TestProxy" transports="vfs">
    <parameter name="transport.vfs.FileURI">file:///home/wso2carbon/in</parameter>
    <parameter name="transport.vfs.ContentType">application/xml</parameter>
    <parameter name="transport.vfs.FileNamePattern">.*\.xml</parameter>
    <parameter name="transport.PollInterval">2</parameter>
    <parameter name="transport.vfs.Streaming">false</parameter>
    <parameter name="transport.vfs.MoveAfterProcess">file:///home/wso2carbon/tmp/archive?transport.vfs.AvoidPermissionCheck=true</parameter>
    <parameter name="transport.vfs.MoveAfterFailure">file:///home/wso2carbon/tmp/bar?transport.vfs.AvoidPermissionCheck=true</parameter>
    <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
    <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
    <parameter name="transport.vfs.CreateFolder">true</parameter>
    <!-- <parameter name="transport.vfs.SubFolderTimestampFormat">/yyyy/MM/dd</parameter>
    <parameter name="transport.vfs.MoveTimestampFormat">yyyyMMdd_HHmmssSSS_</parameter> -->
    <target>
        <inSequence>
           
            <property name="filename" expression="get-property('transport','FILE_NAME')" />
            <property name="transport.vfs.ReplyFileName" expression="$ctx:filename" scope="transport" />
           
            <property action="set" name="OUT_ONLY" value="true" />
           
          
                    <header name="To" value="vfs:file:///home/wso2carbon/OUT?transport.vfs.MaxRetryCount=1&amp;transport.vfs.ReconnectTimeout=1"></header>
            <property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove" />
           
            <call>
                <endpoint>
                    <default />
                </endpoint>
            </call>

        </inSequence>
        <outSequence />
    </target>
</proxy>

In the local file system mount location create a xml file.
You will observe the mentioned error during processing.