lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Chiaretta <simone.chiare...@gmail.com>
Subject Re: Still a problem with medium trust: unmanaged code
Date Mon, 24 May 2010 21:28:21 GMT
Reason is, nobody knows why these two lines are there... maybe they are
there for a reason :)
And since nobody is having that problem except one guy running in a pretty
strange scenario, I'd play on the safe side and just wrap it in a try-catch.
In a "normal" medium trust on Win7 and Win2008 Server it works fine: the
tester that is reporting the problem is running on Win2003 Server with a
custom trust setting (medium trust with something more relaxed and something
less relaxed)

Simone

2010/5/24 Digy <digydigy@gmail.com>

> Hi Simone,
> Since you will get a SecurityException everytime sync is called in medium
> trust, why don't you just comment out that code.
> If I were 100% sure, I would do the same for the Lucene.Net core.
>
> DIGY
>
>
> -----Original Message-----
> From: Simone Chiaretta [mailto:simone.chiaretta@gmail.com]
> Sent: Monday, May 24, 2010 11:59 PM
> To: lucene-net-user@lucene.apache.org
> Subject: Re: Still a problem with medium trust: unmanaged code
>
> ok, thank you
> will wrap it into a silent try-catch block.
> Any chances this could be included in Lucene itself? Would suck to
> apply this change everytime we decide to jump to a newer version of
> lucene.net
>
> simo
>
> On Monday, May 24, 2010, Digy <digydigy@gmail.com> wrote:
> > In 2.4.0 we only used managed flush code and I never saw a bug.
> > DIGY
> >
> > -----Original Message-----
> > From: Simone Chiaretta [mailto:simone.chiaretta@gmail.com]
> > Sent: Monday, May 24, 2010 10:15 PM
> > To: lucene-net-user@lucene.apache.org
> > Subject: Re: Still a problem with medium trust: unmanaged code
> >
> > So I can safely delete/try-catch the unmanaged line?
> > Simo
> >
> > On Monday, May 24, 2010, Digy <digydigy@gmail.com> wrote:
> >> Hi Simone,
> >>
> >> Unmanaged flush is the direct port of java. I think using only the
> managed
> >> one would be enough.
> >> (There were discussions about that in the past, you can find them with
> > some
> >> googling.)
> >>
> >> DIGY
> >>
> >> -----Original Message-----
> >> From: Simone Chiaretta [mailto:simone.chiaretta@gmail.com]
> >> Sent: Monday, May 24, 2010 9:00 PM
> >> To: lucene-net-user@lucene.apache.org
> >> Subject: Re: Still a problem with medium trust: unmanaged code
> >>
> >> Shouldn't the managed Flush be enough? Otherwise this should be a bug
> >> in the CLR.
> >> Or am I missing something?
> >>
> >> This blocks Lucene.net to work in some medium trusts.
> >> Simo
> >>
> >> On Monday, May 24, 2010, Robert Jordan <robertj@gmx.net> wrote:
> >>> On 24.05.2010 17:41, Simone Chiaretta wrote:
> >>>
> >>> Hi all,
> >>> whereas the latest updates fixed the problem with "standard" medium
> > trust,
> >>> in some environment there is also another error being raised:
> >>>
> >>> [SecurityException: Request for the permission of type
> >>> 'System.Security.Permissions.SecurityPermission, mscorlib,
> >> Version=2.0.0.0,
> >>> Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
> >>>     FileSupport.Sync(FileStream fileStream) in SupportClass.cs:495
> >>>     Lucene.Net.Store.FSDirectory.Sync(String name) in
> FSDirectory.cs:831
> >>>     Lucene.Net.Index.SegmentInfos.FinishCommit(Directory dir) in
> >>> SegmentInfos.cs:998
> >>>     ....
> >>>
> >>> It looks like the problem is when the Sync method calls the unmanaged
> >> code:
> >>> private static extern bool FlushFileBuffers(IntPtr hFile);
> >>>
> >>> Is there a reason why both the managed and the unmanaged flush are
> used?
> >>>
> >>>
> >>> Yes. It ensures that the file's cache really hits the file system.
> >>> You may want to add a try-catch block around it as there is
> >>> no other way to achieve this w/out calling into unmanaged code.
> >>>
> >>> Robert
> >>>
> >>>
> >>
> >> --
> >> Simone Chiaretta
> >> Microsoft MVP ASP.NET - ASPInsider
> >> Blog: http://codeclimber.net.nz
> >> RSS: http://feeds2.feedburner.com/codeclimber
> >> twitter: @simonech
> >>
> >> Any sufficiently advanced technology is indistinguishable from magic
> >> "Life is short, play hard"
> >>
> >>
> >
> > --
> > Simone Chiaretta
> > Microsoft MVP ASP.NET - ASPInsider
> > Blog: http://codeclimber.net.nz
> > RSS: http://feeds2.feedburner.com/codeclimber
> > twitter: @simonech
> >
> > Any sufficiently advanced technology is indistinguishable from magic
> > "Life is short, play hard"
> >
> >
>
> --
> Simone Chiaretta
> Microsoft MVP ASP.NET - ASPInsider
> Blog: http://codeclimber.net.nz
> RSS: http://feeds2.feedburner.com/codeclimber
> twitter: @simonech
>
> Any sufficiently advanced technology is indistinguishable from magic
> "Life is short, play hard"
>
>


-- 
Simone Chiaretta
Microsoft MVP ASP.NET - ASPInsider
Blog: http://codeclimber.net.nz
RSS: http://feeds2.feedburner.com/codeclimber
twitter: @simonech

Any sufficiently advanced technology is indistinguishable from magic
"Life is short, play hard"

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message