You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Benoit Tellier (Jira)" <se...@james.apache.org> on 2025/03/03 01:06:00 UTC

[jira] [Commented] (JAMES-4115) FileMailRepository cache is never refreshed

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

Benoit Tellier commented on JAMES-4115:
---------------------------------------

Hello

I did put together https://github.com/apache/james-project/pull/2662 that drops cachekeys and does some minimal refactorings on the FileMailRepository class...

> FileMailRepository cache is never refreshed
> -------------------------------------------
>
>                 Key: JAMES-4115
>                 URL: https://issues.apache.org/jira/browse/JAMES-4115
>             Project: James Server
>          Issue Type: Bug
>          Components: data
>    Affects Versions: 3.8.2
>         Environment: Windows Server 2019 / Java 11
>            Reporter: Søren Hjarlvig
>            Priority: Minor
>         Attachments: mailetcontainer.xml
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When I manually copy a message into a FileMailRepository, it seems that a service restart is required before James sees it.
> Order of events:
>  # Message FileObjectStore and FileStreamStore is copied to /var/mail/retry/
>  # curl -XGET [http://127.0.0.1:8000/mailRepositories/var%2Fmail%2Fretry%2F/mails]
>  # []
>  # Service restart
>  # curl -XGET [http://127.0.0.1:8000/mailRepositories/var%2Fmail%2Fretry%2F/mails]
>  # ["Mail1738937327729-b8303e94-f959-420a-9d18-f6adccf132fa"]
>  # curl -XPATCH [http://127.0.0.1:8000/mailRepositories/var%2Fmail%2Fretry%2F/mails?action=reprocess]
>  # {"taskId":"ff8c877b-8a62-44b8-ba63-64cfb722c785"}
> I took a look at the FileMailRepository source and the behavior seems to be caused by the cache being populated at startup and never refreshed from the filesystem.
> If I disable the FileMailRepository cache in the config, manually added messages are registered as expected:
> <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository">
>   <protocols>
>     <protocol>file</protocol>
>   </protocols>
>    <!-- Set CACHEKEYS to false to register manually added messages -->
>    <config FIFO="false" CACHEKEYS="false"/>
>  </mailrepository>



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

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org