[Mono-dev] SafeFileHandle

2015-01-12 Thread Greg Young
_wapi_handle_unref_full: Attempting to unref unused handle 0x8a

I seem to be getting this message from the runtime not sure what could
be causing it. From some googling this appears to happen when you
close a file handle multiple times.

The only place close is called is :

protected override void Dispose(bool disposing)
{
if(_handle == null) return;
Flush();
_handle.Close();
_handle = null;
   snip

Not sure how it could be called multiple times. I don't get any issues
on the CLR.

Any ideas?

Greg

-- 
Studying for the Turing test
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] SafeFileHandle

2015-01-12 Thread Zoltan Varga
Hi,

  This is a bug, it shouldn't happen. If you have some kind of reproducible
test case, please file a bug report with it.

Zoltan

On Mon, Jan 12, 2015 at 5:28 PM, Greg Young gregoryyou...@gmail.com wrote:

 _wapi_handle_unref_full: Attempting to unref unused handle 0x8a

 I seem to be getting this message from the runtime not sure what could
 be causing it. From some googling this appears to happen when you
 close a file handle multiple times.

 The only place close is called is :

 protected override void Dispose(bool disposing)
 {
 if(_handle == null) return;
 Flush();
 _handle.Close();
 _handle = null;
snip

 Not sure how it could be called multiple times. I don't get any issues
 on the CLR.

 Any ideas?

 Greg

 --
 Studying for the Turing test
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] SafeFileHandle

2015-01-12 Thread Greg Young
I have one I can file. I figured it was something on my side though.

Could it be the FileHandle closing itself later for a second time? Are
there other scenarios aside from close this can happen on?

In general SafeFileHandle is pretty painful to use since none of the
definitions support it.

Want me to create an issue?

Greg

On Tue, Jan 13, 2015 at 12:32 AM, Zoltan Varga var...@gmail.com wrote:
 Hi,

   This is a bug, it shouldn't happen. If you have some kind of reproducible
 test case, please file a bug report with it.

 Zoltan

 On Mon, Jan 12, 2015 at 5:28 PM, Greg Young gregoryyou...@gmail.com wrote:

 _wapi_handle_unref_full: Attempting to unref unused handle 0x8a

 I seem to be getting this message from the runtime not sure what could
 be causing it. From some googling this appears to happen when you
 close a file handle multiple times.

 The only place close is called is :

 protected override void Dispose(bool disposing)
 {
 if(_handle == null) return;
 Flush();
 _handle.Close();
 _handle = null;
snip

 Not sure how it could be called multiple times. I don't get any issues
 on the CLR.

 Any ideas?

 Greg

 --
 Studying for the Turing test
 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list





-- 
Studying for the Turing test
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] SafeFileHandle

2015-01-12 Thread Zoltan Varga
Hi,

  Yes, please file a report.

 Zoltan

On Mon, Jan 12, 2015 at 5:42 PM, Greg Young gregoryyou...@gmail.com wrote:

 I have one I can file. I figured it was something on my side though.

 Could it be the FileHandle closing itself later for a second time? Are
 there other scenarios aside from close this can happen on?

 In general SafeFileHandle is pretty painful to use since none of the
 definitions support it.

 Want me to create an issue?

 Greg

 On Tue, Jan 13, 2015 at 12:32 AM, Zoltan Varga var...@gmail.com wrote:
  Hi,
 
This is a bug, it shouldn't happen. If you have some kind of
 reproducible
  test case, please file a bug report with it.
 
  Zoltan
 
  On Mon, Jan 12, 2015 at 5:28 PM, Greg Young gregoryyou...@gmail.com
 wrote:
 
  _wapi_handle_unref_full: Attempting to unref unused handle 0x8a
 
  I seem to be getting this message from the runtime not sure what could
  be causing it. From some googling this appears to happen when you
  close a file handle multiple times.
 
  The only place close is called is :
 
  protected override void Dispose(bool disposing)
  {
  if(_handle == null) return;
  Flush();
  _handle.Close();
  _handle = null;
 snip
 
  Not sure how it could be called multiple times. I don't get any issues
  on the CLR.
 
  Any ideas?
 
  Greg
 
  --
  Studying for the Turing test
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 



 --
 Studying for the Turing test

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] SafeFileHandle

2015-01-12 Thread Greg Young
Here is the code as well in case you see something obvious. I could
probably make it smaller but this is pretty simple.

The message happens asynchronously well after the code is run (as you
can see from the outputs). Causing a gc seems to make it happen sooner
which made me think finalizer

[Test]
public void shitbird_test() {
   var filename = GetFilePathFor(Guid.NewGuid().ToString());
   using(var stream = new shitstream(filename)) {
   Console.WriteLine(stream.Position);
   }
   Console.WriteLine(done);
}

public class shitstream : Stream {
private SafeFileHandle _handle;

 public shitstream(string filename) {
var han = Syscall.open(filename, OpenFlags.O_CREAT |
OpenFlags.O_RDONLY, FilePermissions.S_IRWXU);
var _handle = new SafeFileHandle((IntPtr) han, true);
if(_handle.IsInvalid) throw new Exception(Invalid handle);
}

public override void Flush() {}
public override long Seek(long offset, SeekOrigin origin){return 0;}

public override void SetLength(long value){}

public override int Read(byte[] buffer, int offset, int count)
{return 0;}
public override void Write(byte[] buffer, int offset, int count) {}

public override bool CanRead
{
get { return true; }
}

public override bool CanSeek
{
get  { return true;}
}

public override bool CanWrite
{
get { return true; }
}

public override long Length
{
get  { return 0;}
}

public override long Position
{
get { return 0;}
set  {}
}

protected override void Dispose(bool disposing)
{
if(_handle == null) return;
_handle.Close();
_handle = null;
GC.SuppressFinalize (this);
}
}

On Tue, Jan 13, 2015 at 12:46 AM, Zoltan Varga var...@gmail.com wrote:
 Hi,

   Yes, please file a report.

  Zoltan

 On Mon, Jan 12, 2015 at 5:42 PM, Greg Young gregoryyou...@gmail.com wrote:

 I have one I can file. I figured it was something on my side though.

 Could it be the FileHandle closing itself later for a second time? Are
 there other scenarios aside from close this can happen on?

 In general SafeFileHandle is pretty painful to use since none of the
 definitions support it.

 Want me to create an issue?

 Greg

 On Tue, Jan 13, 2015 at 12:32 AM, Zoltan Varga var...@gmail.com wrote:
  Hi,
 
This is a bug, it shouldn't happen. If you have some kind of
  reproducible
  test case, please file a bug report with it.
 
  Zoltan
 
  On Mon, Jan 12, 2015 at 5:28 PM, Greg Young gregoryyou...@gmail.com
  wrote:
 
  _wapi_handle_unref_full: Attempting to unref unused handle 0x8a
 
  I seem to be getting this message from the runtime not sure what could
  be causing it. From some googling this appears to happen when you
  close a file handle multiple times.
 
  The only place close is called is :
 
  protected override void Dispose(bool disposing)
  {
  if(_handle == null) return;
  Flush();
  _handle.Close();
  _handle = null;
 snip
 
  Not sure how it could be called multiple times. I don't get any issues
  on the CLR.
 
  Any ideas?
 
  Greg
 
  --
  Studying for the Turing test
  ___
  Mono-devel-list mailing list
  Mono-devel-list@lists.ximian.com
  http://lists.ximian.com/mailman/listinfo/mono-devel-list
 
 



 --
 Studying for the Turing test





-- 
Studying for the Turing test
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] SafeFileHandle marshalling patch

2007-05-11 Thread Jonathan Chambers

Hello,
This patch adds an empty constructor to SafeFileHandle so it can be
marshalled as a return value or an out param for pinvokes. If there is an
easy and useful test to write for this in addition to the runtime safehandle
tests, let me know.

Thanks,
Jonathan


safehandle.diff
Description: Binary data
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list