You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Martin Moore <ma...@gmail.com> on 2022/10/08 16:36:30 UTC

About granting permissions to Tomcat JVM

Hello,

I am facing a problem using Tomcat V8 with my J2ee app that deletes (using
file.delete() Java 8) a file from disk (Windows). The file is actually
deleting only on application level meaning that the application does not
see the file anymore but if i open the folder i still see the file which is
then locked by Java process. I only get the file to be removed physically
when i close the Tomcat instance.

Does this problem relate to permissions in catalina.policy ?
How to solve this?

Re: About granting permissions to Tomcat JVM

Posted by Rob Sargent <rs...@xmission.com>.

> On Oct 8, 2022, at 9:36 AM, Martin Moore <ma...@gmail.com> wrote:
> 
> Hello,
> 
> I am facing a problem using Tomcat V8 with my J2ee app that deletes (using
> file.delete() Java 8) a file from disk (Windows). The file is actually
> deleting only on application level meaning that the application does not
> see the file anymore but if i open the folder i still see the file which is
> then locked by Java process. I only get the file to be removed physically
> when i close the Tomcat instance.
> 
> Does this problem relate to permissions in catalina.policy ?
> How to solve this?

This has a familiar ring to it.  Can we see your entire java command (minus secrets) and any environment variables which have a capital X.  I suspect the JVM is holding off on deleting the file until exit and IIRC there’s a setting for that.  But it has been a while since I dealt with this.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: About granting permissions to Tomcat JVM

Posted by Martin Moore <ma...@gmail.com>.
@Rob  this is the command:   %CATALINA_HOME%\bin\startup.bat


Le dim. 9 oct. 2022 à 21:30, Rob Sargent <rs...@xmission.com> a écrit :

>
>
> > On Oct 9, 2022, at 8:54 AM, Martin Moore <ma...@gmail.com>
> wrote:
> >
> > @Thomas.Hoffmann@speed4trade.com.invalid
> > <Th...@speed4trade.com.invalid>  how to use the debugger in
> this
> > case ?any documentation pls ?
> > @Rob Sargent i posted most of the methods used in the app, but yes JVM is
> > holding off on deleting the file...
>
> I think this might be a config issue. What is the full Java command with
> variables expanded
>
> >
> >> Le dim. 9 oct. 2022 à 17:31, Thomas Hoffmann (Speed4Trade GmbH)
> >> <Th...@speed4trade.com.invalid> a écrit :
> >>
> >> Hello,
> >>
> >>> About the methods i use in the application along with file.delete()
> >> (which is
> >>> what this post is about) I use File[] files = new
> >>> File("C:\\SomeFolder").listFiles();
> >>> file.getName();
> >>> file.lastModified()
> >>> Path path = Paths.get(fileName);
> >>> Would any of these cause the lock on the file ?
> >>
> >> They don't look suspicious to me. What you could do is, use the debugger
> >> to go step by step.
> >> In parallel, use the ProcessExplorer to see at which point the file
> handle
> >> appears.
> >> Maybe it is more hidden in some other routines which might use a
> >> MappedByteBuffer to read or write.
> >>
> >>
> >>>
> >>> Le dim. 9 oct. 2022 à 16:03, Thomas Hoffmann (Speed4Trade GmbH)
> >>> <Th...@speed4trade.com.invalid> a écrit :
> >>>
> >>>>
> >>>>> -----Ursprüngliche Nachricht-----
> >>>>> Von: Martin Moore <ma...@gmail.com>
> >>>>> Gesendet: Sonntag, 9. Oktober 2022 15:37
> >>>>> An: Thomas.Hoffmann@speed4trade.com.invalid; Tomcat Users List
> >>>>> <us...@tomcat.apache.org>
> >>>>> Betreff: Re: About granting permissions to Tomcat JVM
> >>>>>
> >>>>> the ProcessExplorer shows that a Java process is running on the file
> >>>>> and
> >>>> this
> >>>>> only after actually performing the delete from Java.
> >>>>
> >>>>
> >>>> Some possibilities for file locking.
> >>>> - the upload process didn’t close the streams properly
> >>>> - You use http2 and sendfile
> >>>> - You are using a MappedByteBuffer before deletion:
> >>>> https://bugs.openjdk.org/browse/JDK-4724038
> >>>>
> >>>> ... just some ideas which cause file locking ...
> >>>>
> >>>>> Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
> >>>>> <Th...@speed4trade.com.invalid> a écrit :
> >>>>>
> >>>>>> Hello,
> >>>>>> this might be a behavior of the underlying OS.
> >>>>>> If the file is locked, it is marked for deletion and when the file
> >>>>>> lock is released, the file is physically deleted.
> >>>>>>
> >>>>>> Maybe you can check with ProcessExplorer from MS whether there is
> >>>>>> an open file handle on this file.
> >>>>>>
> >>>>>> Greetings,
> >>>>>> Thomas
> >>>>>>
> >>>>>>> -----Ursprüngliche Nachricht-----
> >>>>>>> Von: Martin Moore <ma...@gmail.com>
> >>>>>>> Gesendet: Sonntag, 9. Oktober 2022 09:56
> >>>>>>> An: Tomcat Users List <us...@tomcat.apache.org>;
> >>>>>>> markt@apache.org
> >>>>>>> Betreff: Re: About granting permissions to Tomcat JVM
> >>>>>>>
> >>>>>>> Hello Mark,
> >>>>>>>
> >>>>>>> I don't know if the SecurityManager is enabled or not (how to
> >>>>>>> disable it
> >>>>>>> btw?)
> >>>>>>> I set the env var CATALINA_HOME to be C:/Program
> >>>>>>> Files/Apache-Tomcat-8/ The files in question are stored in
> >>>>>>> Desktop/SomeFolder
> >>>>>>>
> >>>>>>> Thanks.
> >>>>>>>
> >>>>>>> Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a
> >>>>>>> écrit
> >>>> :
> >>>>>>>
> >>>>>>>> On 08/10/2022 17:36, Martin Moore wrote:
> >>>>>>>>> Hello,
> >>>>>>>>>
> >>>>>>>>> I am facing a problem using Tomcat V8 with my J2ee app that
> >>>>>>>>> deletes
> >>>>>>>> (using
> >>>>>>>>> file.delete() Java 8) a file from disk (Windows). The file
> >>>>>>>>> is actually deleting only on application level meaning that
> >>>>>>>>> the application does not see the file anymore but if i open
> >>>>>>>>> the folder i still see the file which
> >>>>>>>> is
> >>>>>>>>> then locked by Java process. I only get the file to be
> >>>>>>>>> removed physically when i close the Tomcat instance.
> >>>>>>>>>
> >>>>>>>>> Does this problem relate to permissions in catalina.policy ?
> >>>>>>>>
> >>>>>>>> Unlikely.
> >>>>>>>>
> >>>>>>>> Are you using a SecurityManager?
> >>>>>>>>
> >>>>>>>>> How to solve this?
> >>>>>>>>
> >>>>>>>> Where, exactly, are you storing these files? Where, exactly,
> >>>>>>>> are CATALINA_HOME and CATALINA_BASE?
> >>>>>>>>
> >>>>>>>> Mark
> >>>>>>>>
> >>>>>>>> --------------------------------------------------------------
> >>>>>>>> ----
> >>>>>>>> --- To unsubscribe, e-mail:
> >>>>>>>> users-unsubscribe@tomcat.apache.org
> >>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>> ------------------------------------------------------------------
> >>>>>> --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >>>> For additional commands, e-mail: users-help@tomcat.apache.org
> >>>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: About granting permissions to Tomcat JVM

Posted by Rob Sargent <rs...@xmission.com>.

> On Oct 9, 2022, at 8:54 AM, Martin Moore <ma...@gmail.com> wrote:
> 
> @Thomas.Hoffmann@speed4trade.com.invalid
> <Th...@speed4trade.com.invalid>  how to use the debugger in this
> case ?any documentation pls ?
> @Rob Sargent i posted most of the methods used in the app, but yes JVM is
> holding off on deleting the file...

I think this might be a config issue. What is the full Java command with variables expanded

> 
>> Le dim. 9 oct. 2022 à 17:31, Thomas Hoffmann (Speed4Trade GmbH)
>> <Th...@speed4trade.com.invalid> a écrit :
>> 
>> Hello,
>> 
>>> About the methods i use in the application along with file.delete()
>> (which is
>>> what this post is about) I use File[] files = new
>>> File("C:\\SomeFolder").listFiles();
>>> file.getName();
>>> file.lastModified()
>>> Path path = Paths.get(fileName);
>>> Would any of these cause the lock on the file ?
>> 
>> They don't look suspicious to me. What you could do is, use the debugger
>> to go step by step.
>> In parallel, use the ProcessExplorer to see at which point the file handle
>> appears.
>> Maybe it is more hidden in some other routines which might use a
>> MappedByteBuffer to read or write.
>> 
>> 
>>> 
>>> Le dim. 9 oct. 2022 à 16:03, Thomas Hoffmann (Speed4Trade GmbH)
>>> <Th...@speed4trade.com.invalid> a écrit :
>>> 
>>>> 
>>>>> -----Ursprüngliche Nachricht-----
>>>>> Von: Martin Moore <ma...@gmail.com>
>>>>> Gesendet: Sonntag, 9. Oktober 2022 15:37
>>>>> An: Thomas.Hoffmann@speed4trade.com.invalid; Tomcat Users List
>>>>> <us...@tomcat.apache.org>
>>>>> Betreff: Re: About granting permissions to Tomcat JVM
>>>>> 
>>>>> the ProcessExplorer shows that a Java process is running on the file
>>>>> and
>>>> this
>>>>> only after actually performing the delete from Java.
>>>> 
>>>> 
>>>> Some possibilities for file locking.
>>>> - the upload process didn’t close the streams properly
>>>> - You use http2 and sendfile
>>>> - You are using a MappedByteBuffer before deletion:
>>>> https://bugs.openjdk.org/browse/JDK-4724038
>>>> 
>>>> ... just some ideas which cause file locking ...
>>>> 
>>>>> Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
>>>>> <Th...@speed4trade.com.invalid> a écrit :
>>>>> 
>>>>>> Hello,
>>>>>> this might be a behavior of the underlying OS.
>>>>>> If the file is locked, it is marked for deletion and when the file
>>>>>> lock is released, the file is physically deleted.
>>>>>> 
>>>>>> Maybe you can check with ProcessExplorer from MS whether there is
>>>>>> an open file handle on this file.
>>>>>> 
>>>>>> Greetings,
>>>>>> Thomas
>>>>>> 
>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>> Von: Martin Moore <ma...@gmail.com>
>>>>>>> Gesendet: Sonntag, 9. Oktober 2022 09:56
>>>>>>> An: Tomcat Users List <us...@tomcat.apache.org>;
>>>>>>> markt@apache.org
>>>>>>> Betreff: Re: About granting permissions to Tomcat JVM
>>>>>>> 
>>>>>>> Hello Mark,
>>>>>>> 
>>>>>>> I don't know if the SecurityManager is enabled or not (how to
>>>>>>> disable it
>>>>>>> btw?)
>>>>>>> I set the env var CATALINA_HOME to be C:/Program
>>>>>>> Files/Apache-Tomcat-8/ The files in question are stored in
>>>>>>> Desktop/SomeFolder
>>>>>>> 
>>>>>>> Thanks.
>>>>>>> 
>>>>>>> Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a
>>>>>>> écrit
>>>> :
>>>>>>> 
>>>>>>>> On 08/10/2022 17:36, Martin Moore wrote:
>>>>>>>>> Hello,
>>>>>>>>> 
>>>>>>>>> I am facing a problem using Tomcat V8 with my J2ee app that
>>>>>>>>> deletes
>>>>>>>> (using
>>>>>>>>> file.delete() Java 8) a file from disk (Windows). The file
>>>>>>>>> is actually deleting only on application level meaning that
>>>>>>>>> the application does not see the file anymore but if i open
>>>>>>>>> the folder i still see the file which
>>>>>>>> is
>>>>>>>>> then locked by Java process. I only get the file to be
>>>>>>>>> removed physically when i close the Tomcat instance.
>>>>>>>>> 
>>>>>>>>> Does this problem relate to permissions in catalina.policy ?
>>>>>>>> 
>>>>>>>> Unlikely.
>>>>>>>> 
>>>>>>>> Are you using a SecurityManager?
>>>>>>>> 
>>>>>>>>> How to solve this?
>>>>>>>> 
>>>>>>>> Where, exactly, are you storing these files? Where, exactly,
>>>>>>>> are CATALINA_HOME and CATALINA_BASE?
>>>>>>>> 
>>>>>>>> Mark
>>>>>>>> 
>>>>>>>> --------------------------------------------------------------
>>>>>>>> ----
>>>>>>>> --- To unsubscribe, e-mail:
>>>>>>>> users-unsubscribe@tomcat.apache.org
>>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> ------------------------------------------------------------------
>>>>>> --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


AW: About granting permissions to Tomcat JVM

Posted by "Thomas Hoffmann (Speed4Trade GmbH)" <Th...@speed4trade.com.INVALID>.
Hello,

> -----Ursprüngliche Nachricht-----
> Von: Martin Moore <ma...@gmail.com>
> Gesendet: Sonntag, 9. Oktober 2022 17:59
> An: Tomcat Users List <us...@tomcat.apache.org>
> Betreff: Re: About granting permissions to Tomcat JVM
> 
> @Thomas.Hoffmann@speed4trade.com.invalid
> <Th...@speed4trade.com.invalid>  how to use the debugger in
> this case ?any documentation pls ?

For debugging you need the sources. Either you have a development environment where you start debugging.
Alternatively you can open a JMX port and do remote debugging (e.g. with eclipse)
Details about remote debugging are e.g. https://stackify.com/java-remote-debugging/ 

I don’t think that there a libs or something else missing. As you see an open file handle, the next step is to
figure out which part of the program is causing the left open file handle.


> @Rob Sargent i posted most of the methods used in the app, but yes JVM is
> holding off on deleting the file...
> 
> Le dim. 9 oct. 2022 à 17:31, Thomas Hoffmann (Speed4Trade GmbH)
> <Th...@speed4trade.com.invalid> a écrit :
> 
> > Hello,
> >
> > > About the methods i use in the application along with file.delete()
> > (which is
> > > what this post is about) I use File[] files = new
> > > File("C:\\SomeFolder").listFiles();
> > > file.getName();
> > > file.lastModified()
> > > Path path = Paths.get(fileName);
> > > Would any of these cause the lock on the file ?
> >
> > They don't look suspicious to me. What you could do is, use the
> > debugger to go step by step.
> > In parallel, use the ProcessExplorer to see at which point the file
> > handle appears.
> > Maybe it is more hidden in some other routines which might use a
> > MappedByteBuffer to read or write.
> >
> >
> > >
> > > Le dim. 9 oct. 2022 à 16:03, Thomas Hoffmann (Speed4Trade GmbH)
> > > <Th...@speed4trade.com.invalid> a écrit :
> > >
> > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Martin Moore <ma...@gmail.com>
> > > > > Gesendet: Sonntag, 9. Oktober 2022 15:37
> > > > > An: Thomas.Hoffmann@speed4trade.com.invalid; Tomcat Users List
> > > > > <us...@tomcat.apache.org>
> > > > > Betreff: Re: About granting permissions to Tomcat JVM
> > > > >
> > > > > the ProcessExplorer shows that a Java process is running on the
> > > > > file and
> > > > this
> > > > > only after actually performing the delete from Java.
> > > >
> > > >
> > > > Some possibilities for file locking.
> > > > - the upload process didn’t close the streams properly
> > > > - You use http2 and sendfile
> > > > - You are using a MappedByteBuffer before deletion:
> > > > https://bugs.openjdk.org/browse/JDK-4724038
> > > >
> > > > ... just some ideas which cause file locking ...
> > > >
> > > > > Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
> > > > > <Th...@speed4trade.com.invalid> a écrit :
> > > > >
> > > > > > Hello,
> > > > > > this might be a behavior of the underlying OS.
> > > > > > If the file is locked, it is marked for deletion and when the
> > > > > > file lock is released, the file is physically deleted.
> > > > > >
> > > > > > Maybe you can check with ProcessExplorer from MS whether there
> > > > > > is an open file handle on this file.
> > > > > >
> > > > > > Greetings,
> > > > > > Thomas
> > > > > >
> > > > > > > -----Ursprüngliche Nachricht-----
> > > > > > > Von: Martin Moore <ma...@gmail.com>
> > > > > > > Gesendet: Sonntag, 9. Oktober 2022 09:56
> > > > > > > An: Tomcat Users List <us...@tomcat.apache.org>;
> > > > > > > markt@apache.org
> > > > > > > Betreff: Re: About granting permissions to Tomcat JVM
> > > > > > >
> > > > > > > Hello Mark,
> > > > > > >
> > > > > > > I don't know if the SecurityManager is enabled or not (how
> > > > > > > to disable it
> > > > > > > btw?)
> > > > > > > I set the env var CATALINA_HOME to be C:/Program
> > > > > > > Files/Apache-Tomcat-8/ The files in question are stored in
> > > > > > > Desktop/SomeFolder
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org>
> > > > > > > a écrit
> > > > :
> > > > > > >
> > > > > > > > On 08/10/2022 17:36, Martin Moore wrote:
> > > > > > > > > Hello,
> > > > > > > > >
> > > > > > > > > I am facing a problem using Tomcat V8 with my J2ee app
> > > > > > > > > that deletes
> > > > > > > > (using
> > > > > > > > > file.delete() Java 8) a file from disk (Windows). The
> > > > > > > > > file is actually deleting only on application level
> > > > > > > > > meaning that the application does not see the file
> > > > > > > > > anymore but if i open the folder i still see the file
> > > > > > > > > which
> > > > > > > > is
> > > > > > > > > then locked by Java process. I only get the file to be
> > > > > > > > > removed physically when i close the Tomcat instance.
> > > > > > > > >
> > > > > > > > > Does this problem relate to permissions in catalina.policy ?
> > > > > > > >
> > > > > > > > Unlikely.
> > > > > > > >
> > > > > > > > Are you using a SecurityManager?
> > > > > > > >
> > > > > > > > > How to solve this?
> > > > > > > >
> > > > > > > > Where, exactly, are you storing these files? Where,
> > > > > > > > exactly, are CATALINA_HOME and CATALINA_BASE?
> > > > > > > >
> > > > > > > > Mark
> > > > > > > >
> > > > > > > > ----------------------------------------------------------
> > > > > > > > ----
> > > > > > > > ----
> > > > > > > > --- To unsubscribe, e-mail:
> > > > > > > > users-unsubscribe@tomcat.apache.org
> > > > > > > > For additional commands, e-mail:
> > > > > > > > users-help@tomcat.apache.org
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > > > --------------------------------------------------------------
> > > > > > ----
> > > > > > --- To unsubscribe, e-mail:
> > > > > > users-unsubscribe@tomcat.apache.org
> > > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > > >
> > > >
> > > > ------------------------------------------------------------------
> > > > --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >

Re: About granting permissions to Tomcat JVM

Posted by Martin Moore <ma...@gmail.com>.
@Thomas.Hoffmann@speed4trade.com.invalid
<Th...@speed4trade.com.invalid>  how to use the debugger in this
case ?any documentation pls ?
@Rob Sargent i posted most of the methods used in the app, but yes JVM is
holding off on deleting the file...

Le dim. 9 oct. 2022 à 17:31, Thomas Hoffmann (Speed4Trade GmbH)
<Th...@speed4trade.com.invalid> a écrit :

> Hello,
>
> > About the methods i use in the application along with file.delete()
> (which is
> > what this post is about) I use File[] files = new
> > File("C:\\SomeFolder").listFiles();
> > file.getName();
> > file.lastModified()
> > Path path = Paths.get(fileName);
> > Would any of these cause the lock on the file ?
>
> They don't look suspicious to me. What you could do is, use the debugger
> to go step by step.
> In parallel, use the ProcessExplorer to see at which point the file handle
> appears.
> Maybe it is more hidden in some other routines which might use a
> MappedByteBuffer to read or write.
>
>
> >
> > Le dim. 9 oct. 2022 à 16:03, Thomas Hoffmann (Speed4Trade GmbH)
> > <Th...@speed4trade.com.invalid> a écrit :
> >
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Martin Moore <ma...@gmail.com>
> > > > Gesendet: Sonntag, 9. Oktober 2022 15:37
> > > > An: Thomas.Hoffmann@speed4trade.com.invalid; Tomcat Users List
> > > > <us...@tomcat.apache.org>
> > > > Betreff: Re: About granting permissions to Tomcat JVM
> > > >
> > > > the ProcessExplorer shows that a Java process is running on the file
> > > > and
> > > this
> > > > only after actually performing the delete from Java.
> > >
> > >
> > > Some possibilities for file locking.
> > > - the upload process didn’t close the streams properly
> > > - You use http2 and sendfile
> > > - You are using a MappedByteBuffer before deletion:
> > > https://bugs.openjdk.org/browse/JDK-4724038
> > >
> > > ... just some ideas which cause file locking ...
> > >
> > > > Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
> > > > <Th...@speed4trade.com.invalid> a écrit :
> > > >
> > > > > Hello,
> > > > > this might be a behavior of the underlying OS.
> > > > > If the file is locked, it is marked for deletion and when the file
> > > > > lock is released, the file is physically deleted.
> > > > >
> > > > > Maybe you can check with ProcessExplorer from MS whether there is
> > > > > an open file handle on this file.
> > > > >
> > > > > Greetings,
> > > > > Thomas
> > > > >
> > > > > > -----Ursprüngliche Nachricht-----
> > > > > > Von: Martin Moore <ma...@gmail.com>
> > > > > > Gesendet: Sonntag, 9. Oktober 2022 09:56
> > > > > > An: Tomcat Users List <us...@tomcat.apache.org>;
> > > > > > markt@apache.org
> > > > > > Betreff: Re: About granting permissions to Tomcat JVM
> > > > > >
> > > > > > Hello Mark,
> > > > > >
> > > > > > I don't know if the SecurityManager is enabled or not (how to
> > > > > > disable it
> > > > > > btw?)
> > > > > > I set the env var CATALINA_HOME to be C:/Program
> > > > > > Files/Apache-Tomcat-8/ The files in question are stored in
> > > > > > Desktop/SomeFolder
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a
> > > > > > écrit
> > > :
> > > > > >
> > > > > > > On 08/10/2022 17:36, Martin Moore wrote:
> > > > > > > > Hello,
> > > > > > > >
> > > > > > > > I am facing a problem using Tomcat V8 with my J2ee app that
> > > > > > > > deletes
> > > > > > > (using
> > > > > > > > file.delete() Java 8) a file from disk (Windows). The file
> > > > > > > > is actually deleting only on application level meaning that
> > > > > > > > the application does not see the file anymore but if i open
> > > > > > > > the folder i still see the file which
> > > > > > > is
> > > > > > > > then locked by Java process. I only get the file to be
> > > > > > > > removed physically when i close the Tomcat instance.
> > > > > > > >
> > > > > > > > Does this problem relate to permissions in catalina.policy ?
> > > > > > >
> > > > > > > Unlikely.
> > > > > > >
> > > > > > > Are you using a SecurityManager?
> > > > > > >
> > > > > > > > How to solve this?
> > > > > > >
> > > > > > > Where, exactly, are you storing these files? Where, exactly,
> > > > > > > are CATALINA_HOME and CATALINA_BASE?
> > > > > > >
> > > > > > > Mark
> > > > > > >
> > > > > > > --------------------------------------------------------------
> > > > > > > ----
> > > > > > > --- To unsubscribe, e-mail:
> > > > > > > users-unsubscribe@tomcat.apache.org
> > > > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > > > >
> > > > > > >
> > > > >
> > > > > ------------------------------------------------------------------
> > > > > --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

AW: About granting permissions to Tomcat JVM

Posted by "Thomas Hoffmann (Speed4Trade GmbH)" <Th...@speed4trade.com.INVALID>.
Hello,
 
> About the methods i use in the application along with file.delete() (which is
> what this post is about) I use File[] files = new
> File("C:\\SomeFolder").listFiles();
> file.getName();
> file.lastModified()
> Path path = Paths.get(fileName);
> Would any of these cause the lock on the file ?

They don't look suspicious to me. What you could do is, use the debugger to go step by step.
In parallel, use the ProcessExplorer to see at which point the file handle appears.
Maybe it is more hidden in some other routines which might use a MappedByteBuffer to read or write.


> 
> Le dim. 9 oct. 2022 à 16:03, Thomas Hoffmann (Speed4Trade GmbH)
> <Th...@speed4trade.com.invalid> a écrit :
> 
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Martin Moore <ma...@gmail.com>
> > > Gesendet: Sonntag, 9. Oktober 2022 15:37
> > > An: Thomas.Hoffmann@speed4trade.com.invalid; Tomcat Users List
> > > <us...@tomcat.apache.org>
> > > Betreff: Re: About granting permissions to Tomcat JVM
> > >
> > > the ProcessExplorer shows that a Java process is running on the file
> > > and
> > this
> > > only after actually performing the delete from Java.
> >
> >
> > Some possibilities for file locking.
> > - the upload process didn’t close the streams properly
> > - You use http2 and sendfile
> > - You are using a MappedByteBuffer before deletion:
> > https://bugs.openjdk.org/browse/JDK-4724038
> >
> > ... just some ideas which cause file locking ...
> >
> > > Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
> > > <Th...@speed4trade.com.invalid> a écrit :
> > >
> > > > Hello,
> > > > this might be a behavior of the underlying OS.
> > > > If the file is locked, it is marked for deletion and when the file
> > > > lock is released, the file is physically deleted.
> > > >
> > > > Maybe you can check with ProcessExplorer from MS whether there is
> > > > an open file handle on this file.
> > > >
> > > > Greetings,
> > > > Thomas
> > > >
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: Martin Moore <ma...@gmail.com>
> > > > > Gesendet: Sonntag, 9. Oktober 2022 09:56
> > > > > An: Tomcat Users List <us...@tomcat.apache.org>;
> > > > > markt@apache.org
> > > > > Betreff: Re: About granting permissions to Tomcat JVM
> > > > >
> > > > > Hello Mark,
> > > > >
> > > > > I don't know if the SecurityManager is enabled or not (how to
> > > > > disable it
> > > > > btw?)
> > > > > I set the env var CATALINA_HOME to be C:/Program
> > > > > Files/Apache-Tomcat-8/ The files in question are stored in
> > > > > Desktop/SomeFolder
> > > > >
> > > > > Thanks.
> > > > >
> > > > > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a
> > > > > écrit
> > :
> > > > >
> > > > > > On 08/10/2022 17:36, Martin Moore wrote:
> > > > > > > Hello,
> > > > > > >
> > > > > > > I am facing a problem using Tomcat V8 with my J2ee app that
> > > > > > > deletes
> > > > > > (using
> > > > > > > file.delete() Java 8) a file from disk (Windows). The file
> > > > > > > is actually deleting only on application level meaning that
> > > > > > > the application does not see the file anymore but if i open
> > > > > > > the folder i still see the file which
> > > > > > is
> > > > > > > then locked by Java process. I only get the file to be
> > > > > > > removed physically when i close the Tomcat instance.
> > > > > > >
> > > > > > > Does this problem relate to permissions in catalina.policy ?
> > > > > >
> > > > > > Unlikely.
> > > > > >
> > > > > > Are you using a SecurityManager?
> > > > > >
> > > > > > > How to solve this?
> > > > > >
> > > > > > Where, exactly, are you storing these files? Where, exactly,
> > > > > > are CATALINA_HOME and CATALINA_BASE?
> > > > > >
> > > > > > Mark
> > > > > >
> > > > > > --------------------------------------------------------------
> > > > > > ----
> > > > > > --- To unsubscribe, e-mail:
> > > > > > users-unsubscribe@tomcat.apache.org
> > > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > > >
> > > > > >
> > > >
> > > > ------------------------------------------------------------------
> > > > --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: About granting permissions to Tomcat JVM

Posted by Martin Moore <ma...@gmail.com>.
About the methods i use in the application along with file.delete() (which
is what this post is about)
I use File[] files = new File("C:\\SomeFolder").listFiles();
file.getName();
file.lastModified()
Path path = Paths.get(fileName);
Would any of these cause the lock on the file ?

Le dim. 9 oct. 2022 à 16:03, Thomas Hoffmann (Speed4Trade GmbH)
<Th...@speed4trade.com.invalid> a écrit :

>
> > -----Ursprüngliche Nachricht-----
> > Von: Martin Moore <ma...@gmail.com>
> > Gesendet: Sonntag, 9. Oktober 2022 15:37
> > An: Thomas.Hoffmann@speed4trade.com.invalid; Tomcat Users List
> > <us...@tomcat.apache.org>
> > Betreff: Re: About granting permissions to Tomcat JVM
> >
> > the ProcessExplorer shows that a Java process is running on the file and
> this
> > only after actually performing the delete from Java.
>
>
> Some possibilities for file locking.
> - the upload process didn’t close the streams properly
> - You use http2 and sendfile
> - You are using a MappedByteBuffer before deletion:
> https://bugs.openjdk.org/browse/JDK-4724038
>
> ... just some ideas which cause file locking ...
>
> > Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
> > <Th...@speed4trade.com.invalid> a écrit :
> >
> > > Hello,
> > > this might be a behavior of the underlying OS.
> > > If the file is locked, it is marked for deletion and when the file
> > > lock is released, the file is physically deleted.
> > >
> > > Maybe you can check with ProcessExplorer from MS whether there is an
> > > open file handle on this file.
> > >
> > > Greetings,
> > > Thomas
> > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Martin Moore <ma...@gmail.com>
> > > > Gesendet: Sonntag, 9. Oktober 2022 09:56
> > > > An: Tomcat Users List <us...@tomcat.apache.org>; markt@apache.org
> > > > Betreff: Re: About granting permissions to Tomcat JVM
> > > >
> > > > Hello Mark,
> > > >
> > > > I don't know if the SecurityManager is enabled or not (how to
> > > > disable it
> > > > btw?)
> > > > I set the env var CATALINA_HOME to be C:/Program
> > > > Files/Apache-Tomcat-8/ The files in question are stored in
> > > > Desktop/SomeFolder
> > > >
> > > > Thanks.
> > > >
> > > > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a écrit
> :
> > > >
> > > > > On 08/10/2022 17:36, Martin Moore wrote:
> > > > > > Hello,
> > > > > >
> > > > > > I am facing a problem using Tomcat V8 with my J2ee app that
> > > > > > deletes
> > > > > (using
> > > > > > file.delete() Java 8) a file from disk (Windows). The file is
> > > > > > actually deleting only on application level meaning that the
> > > > > > application does not see the file anymore but if i open the
> > > > > > folder i still see the file which
> > > > > is
> > > > > > then locked by Java process. I only get the file to be removed
> > > > > > physically when i close the Tomcat instance.
> > > > > >
> > > > > > Does this problem relate to permissions in catalina.policy ?
> > > > >
> > > > > Unlikely.
> > > > >
> > > > > Are you using a SecurityManager?
> > > > >
> > > > > > How to solve this?
> > > > >
> > > > > Where, exactly, are you storing these files? Where, exactly, are
> > > > > CATALINA_HOME and CATALINA_BASE?
> > > > >
> > > > > Mark
> > > > >
> > > > > ------------------------------------------------------------------
> > > > > --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > >
> > > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

AW: About granting permissions to Tomcat JVM

Posted by "Thomas Hoffmann (Speed4Trade GmbH)" <Th...@speed4trade.com.INVALID>.
> -----Ursprüngliche Nachricht-----
> Von: Martin Moore <ma...@gmail.com>
> Gesendet: Sonntag, 9. Oktober 2022 15:37
> An: Thomas.Hoffmann@speed4trade.com.invalid; Tomcat Users List
> <us...@tomcat.apache.org>
> Betreff: Re: About granting permissions to Tomcat JVM
> 
> the ProcessExplorer shows that a Java process is running on the file and this
> only after actually performing the delete from Java.


Some possibilities for file locking.
- the upload process didn’t close the streams properly
- You use http2 and sendfile
- You are using a MappedByteBuffer before deletion: https://bugs.openjdk.org/browse/JDK-4724038

... just some ideas which cause file locking ...
 
> Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
> <Th...@speed4trade.com.invalid> a écrit :
> 
> > Hello,
> > this might be a behavior of the underlying OS.
> > If the file is locked, it is marked for deletion and when the file
> > lock is released, the file is physically deleted.
> >
> > Maybe you can check with ProcessExplorer from MS whether there is an
> > open file handle on this file.
> >
> > Greetings,
> > Thomas
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Martin Moore <ma...@gmail.com>
> > > Gesendet: Sonntag, 9. Oktober 2022 09:56
> > > An: Tomcat Users List <us...@tomcat.apache.org>; markt@apache.org
> > > Betreff: Re: About granting permissions to Tomcat JVM
> > >
> > > Hello Mark,
> > >
> > > I don't know if the SecurityManager is enabled or not (how to
> > > disable it
> > > btw?)
> > > I set the env var CATALINA_HOME to be C:/Program
> > > Files/Apache-Tomcat-8/ The files in question are stored in
> > > Desktop/SomeFolder
> > >
> > > Thanks.
> > >
> > > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a écrit :
> > >
> > > > On 08/10/2022 17:36, Martin Moore wrote:
> > > > > Hello,
> > > > >
> > > > > I am facing a problem using Tomcat V8 with my J2ee app that
> > > > > deletes
> > > > (using
> > > > > file.delete() Java 8) a file from disk (Windows). The file is
> > > > > actually deleting only on application level meaning that the
> > > > > application does not see the file anymore but if i open the
> > > > > folder i still see the file which
> > > > is
> > > > > then locked by Java process. I only get the file to be removed
> > > > > physically when i close the Tomcat instance.
> > > > >
> > > > > Does this problem relate to permissions in catalina.policy ?
> > > >
> > > > Unlikely.
> > > >
> > > > Are you using a SecurityManager?
> > > >
> > > > > How to solve this?
> > > >
> > > > Where, exactly, are you storing these files? Where, exactly, are
> > > > CATALINA_HOME and CATALINA_BASE?
> > > >
> > > > Mark
> > > >
> > > > ------------------------------------------------------------------
> > > > --- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: About granting permissions to Tomcat JVM

Posted by Suvendu Sekhar Mondal <su...@gmail.com>.
Hello Martin,

On Sun, Oct 9, 2022 at 7:03 PM Martin Moore <ma...@gmail.com> wrote:
>
> the ProcessExplorer shows that a Java process is running on the file and
> this only after actually performing the delete from Java.
>
Sometimes Logstash gives me trouble like this.

Most probably some part of the app was still holding reference to the
file. Can you please ensure your app is closing all input/output
streams after using them to access the file?

> Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
> <Th...@speed4trade.com.invalid> a écrit :
>
> > Hello,
> > this might be a behavior of the underlying OS.
> > If the file is locked, it is marked for deletion and when the file lock is
> > released, the file is physically deleted.
> >
> > Maybe you can check with ProcessExplorer from MS whether there is an open
> > file handle on this file.
> >
> > Greetings,
> > Thomas
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Martin Moore <ma...@gmail.com>
> > > Gesendet: Sonntag, 9. Oktober 2022 09:56
> > > An: Tomcat Users List <us...@tomcat.apache.org>; markt@apache.org
> > > Betreff: Re: About granting permissions to Tomcat JVM
> > >
> > > Hello Mark,
> > >
> > > I don't know if the SecurityManager is enabled or not (how to disable it
> > > btw?)
> > > I set the env var CATALINA_HOME to be C:/Program Files/Apache-Tomcat-8/
> > > The files in question are stored in Desktop/SomeFolder
> > >
> > > Thanks.
> > >
> > > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a écrit :
> > >
> > > > On 08/10/2022 17:36, Martin Moore wrote:
> > > > > Hello,
> > > > >
> > > > > I am facing a problem using Tomcat V8 with my J2ee app that deletes
> > > > (using
> > > > > file.delete() Java 8) a file from disk (Windows). The file is
> > > > > actually deleting only on application level meaning that the
> > > > > application does not see the file anymore but if i open the folder i
> > > > > still see the file which
> > > > is
> > > > > then locked by Java process. I only get the file to be removed
> > > > > physically when i close the Tomcat instance.
> > > > >
> > > > > Does this problem relate to permissions in catalina.policy ?
> > > >
> > > > Unlikely.
> > > >
> > > > Are you using a SecurityManager?
> > > >
> > > > > How to solve this?
> > > >
> > > > Where, exactly, are you storing these files? Where, exactly, are
> > > > CATALINA_HOME and CATALINA_BASE?
> > > >
> > > > Mark
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: About granting permissions to Tomcat JVM

Posted by Martin Moore <ma...@gmail.com>.
the ProcessExplorer shows that a Java process is running on the file and
this only after actually performing the delete from Java.

Le dim. 9 oct. 2022 à 15:23, Thomas Hoffmann (Speed4Trade GmbH)
<Th...@speed4trade.com.invalid> a écrit :

> Hello,
> this might be a behavior of the underlying OS.
> If the file is locked, it is marked for deletion and when the file lock is
> released, the file is physically deleted.
>
> Maybe you can check with ProcessExplorer from MS whether there is an open
> file handle on this file.
>
> Greetings,
> Thomas
>
> > -----Ursprüngliche Nachricht-----
> > Von: Martin Moore <ma...@gmail.com>
> > Gesendet: Sonntag, 9. Oktober 2022 09:56
> > An: Tomcat Users List <us...@tomcat.apache.org>; markt@apache.org
> > Betreff: Re: About granting permissions to Tomcat JVM
> >
> > Hello Mark,
> >
> > I don't know if the SecurityManager is enabled or not (how to disable it
> > btw?)
> > I set the env var CATALINA_HOME to be C:/Program Files/Apache-Tomcat-8/
> > The files in question are stored in Desktop/SomeFolder
> >
> > Thanks.
> >
> > Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a écrit :
> >
> > > On 08/10/2022 17:36, Martin Moore wrote:
> > > > Hello,
> > > >
> > > > I am facing a problem using Tomcat V8 with my J2ee app that deletes
> > > (using
> > > > file.delete() Java 8) a file from disk (Windows). The file is
> > > > actually deleting only on application level meaning that the
> > > > application does not see the file anymore but if i open the folder i
> > > > still see the file which
> > > is
> > > > then locked by Java process. I only get the file to be removed
> > > > physically when i close the Tomcat instance.
> > > >
> > > > Does this problem relate to permissions in catalina.policy ?
> > >
> > > Unlikely.
> > >
> > > Are you using a SecurityManager?
> > >
> > > > How to solve this?
> > >
> > > Where, exactly, are you storing these files? Where, exactly, are
> > > CATALINA_HOME and CATALINA_BASE?
> > >
> > > Mark
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

AW: About granting permissions to Tomcat JVM

Posted by "Thomas Hoffmann (Speed4Trade GmbH)" <Th...@speed4trade.com.INVALID>.
Hello,
this might be a behavior of the underlying OS.
If the file is locked, it is marked for deletion and when the file lock is released, the file is physically deleted.

Maybe you can check with ProcessExplorer from MS whether there is an open file handle on this file.

Greetings,
Thomas

> -----Ursprüngliche Nachricht-----
> Von: Martin Moore <ma...@gmail.com>
> Gesendet: Sonntag, 9. Oktober 2022 09:56
> An: Tomcat Users List <us...@tomcat.apache.org>; markt@apache.org
> Betreff: Re: About granting permissions to Tomcat JVM
> 
> Hello Mark,
> 
> I don't know if the SecurityManager is enabled or not (how to disable it
> btw?)
> I set the env var CATALINA_HOME to be C:/Program Files/Apache-Tomcat-8/
> The files in question are stored in Desktop/SomeFolder
> 
> Thanks.
> 
> Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a écrit :
> 
> > On 08/10/2022 17:36, Martin Moore wrote:
> > > Hello,
> > >
> > > I am facing a problem using Tomcat V8 with my J2ee app that deletes
> > (using
> > > file.delete() Java 8) a file from disk (Windows). The file is
> > > actually deleting only on application level meaning that the
> > > application does not see the file anymore but if i open the folder i
> > > still see the file which
> > is
> > > then locked by Java process. I only get the file to be removed
> > > physically when i close the Tomcat instance.
> > >
> > > Does this problem relate to permissions in catalina.policy ?
> >
> > Unlikely.
> >
> > Are you using a SecurityManager?
> >
> > > How to solve this?
> >
> > Where, exactly, are you storing these files? Where, exactly, are
> > CATALINA_HOME and CATALINA_BASE?
> >
> > Mark
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: About granting permissions to Tomcat JVM

Posted by Martin Moore <ma...@gmail.com>.
Hello Mark,

I don't know if the SecurityManager is enabled or not (how to disable it
btw?)
I set the env var CATALINA_HOME to be C:/Program Files/Apache-Tomcat-8/
The files in question are stored in Desktop/SomeFolder

Thanks.

Le dim. 9 oct. 2022 à 08:00, Mark Thomas <ma...@apache.org> a écrit :

> On 08/10/2022 17:36, Martin Moore wrote:
> > Hello,
> >
> > I am facing a problem using Tomcat V8 with my J2ee app that deletes
> (using
> > file.delete() Java 8) a file from disk (Windows). The file is actually
> > deleting only on application level meaning that the application does not
> > see the file anymore but if i open the folder i still see the file which
> is
> > then locked by Java process. I only get the file to be removed physically
> > when i close the Tomcat instance.
> >
> > Does this problem relate to permissions in catalina.policy ?
>
> Unlikely.
>
> Are you using a SecurityManager?
>
> > How to solve this?
>
> Where, exactly, are you storing these files? Where, exactly, are
> CATALINA_HOME and CATALINA_BASE?
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: About granting permissions to Tomcat JVM

Posted by Mark Thomas <ma...@apache.org>.
On 08/10/2022 17:36, Martin Moore wrote:
> Hello,
> 
> I am facing a problem using Tomcat V8 with my J2ee app that deletes (using
> file.delete() Java 8) a file from disk (Windows). The file is actually
> deleting only on application level meaning that the application does not
> see the file anymore but if i open the folder i still see the file which is
> then locked by Java process. I only get the file to be removed physically
> when i close the Tomcat instance.
> 
> Does this problem relate to permissions in catalina.policy ?

Unlikely.

Are you using a SecurityManager?

> How to solve this?

Where, exactly, are you storing these files? Where, exactly, are 
CATALINA_HOME and CATALINA_BASE?

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: [EXTERNAL EMAIL] About granting permissions to Tomcat JVM

Posted by Niranjan Rao <nr...@paymentus.com>.
Are you using FileInputStream or FileOutputSteam on the file and closing 
the stream before deletion? If so, change to Files.newInputSteam or 
Files.newOutputStream.

One of our application (not a web application) was running out of file 
handles even though we were closing the file handles. Everything was in 
try block and we did verify the handles were closed as far our code was 
concerned. It turned out that JVM does not close the actual handles 
until late in the game. There is a bug on openjdk bugs tracker that 
discusses this. After using Files, our issue was resolved.

If you are closing the file and JVM is not releasing the handles, this 
sounds very similar to the issue we faced.


Regards,


Niranjan


On 10/8/22 09:36, Martin Moore wrote:
> Hello, I am facing a problem using Tomcat V8 with my J2ee app that 
> deletes (using file. delete() Java 8) a file from disk (Windows). The 
> file is actually deleting only on application level meaning that the 
> application does not see the file anymore
> ZjQcmQRYFpfptBannerStart
> This Message Is From an Untrusted Sender
> You have not previously corresponded with this sender.
> ZjQcmQRYFpfptBannerEnd
> Hello,
>
> I am facing a problem using Tomcat V8 with my J2ee app that deletes (using
> file.delete() Java 8) a file from disk (Windows). The file is actually
> deleting only on application level meaning that the application does not
> see the file anymore but if i open the folder i still see the file which is
> then locked by Java process. I only get the file to be removed physically
> when i close the Tomcat instance.
>
> Does this problem relate to permissions in catalina.policy ?
> How to solve this?