RE: [Filesystem-dev] CR: Error handler for filesystem exception due to usb disk unplug
"Eric Hyche" <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Organization | RealNetworks, Inc. |
| Message-ID | <004501c8e82a$5ed53280$1c7f9780$@com> |
Halley,
Actually I think we should fix bug 8471 at a different level. I noticed that on Mac OSX, we do a check in MemoryMapDataFile::Bind()
to check if the disk is ejectable and if it is, we disable memory-mapped I/O:
// if a windows share (smb) is shut down remotely then if
// we're memory-mapping we crash. This happened with the
// windows implementation of MemoryMapDataFile ages ago,
// and I'm pulling over their solution which is to ensure
// that memory mapping does not happen unless the disk is
// local AND non-ejectable.
if (!CHXFileSpecUtils::IsDiskLocal(dirSpec) || CHXFileSpecUtils::IsDiskEjectable(dirSpec))
{
bMemMappingOK = false;
}
Seems like we could do something similar on Linux. Unfortunately, CHXFileSpecUtils::IsDiskEjectable() currently always returns FALSE
on Unix. I think if we added a similar check for IsDiskEjectable() and actually implemented IsDiskEjectable() on Unix, then what
would happen would be that memory-mapped I/O would be disabled for USB disks.
I believe one of our devs has verified that if memory-mapped I/O is disabled, then this solves the crash in 8471. But I think he was
just testing this by hard-coding it to disable memory-mapped I/O. I think what I described above is the proper way to disable
memory-mapped I/O for USB disks.
Halley, do you want to make this change, or you do want to have one of our devs do it?
Eric
=======================================
Eric Hyche ([email protected])
Senior Technical Lead
RealNetworks, Inc.
>-----Original Message-----
>From: [email protected] [mailto:[email protected]] On
>Behalf Of Zhao, Halley
>Sent: Thursday, July 17, 2008 4:58 AM
>To: [email protected]; [email protected]
>Cc: [email protected]; [email protected]
>Subject: [Filesystem-dev] CR: Error handler for filesystem exception due to usb disk unplug
>
> I'm not familiar with file system plugin, please kindly review the patch and give your suggestion.
>
> Great thanks.
>
>
>
>Synopsis:
>
> The patch fix bug #8471: Device hang up after play music from USB then plug out and plug in the
>USB.
>
> I added error handle for usb disk unplug exception.
>
>
>
>Overview:
>
> Memory map is used in helix plugin for file io, In GetBlock() of common/fileio/mmapmgr.cpp,
>
>the pBuffer address is calculated from the memory page information. it may be invalid due to the
>device being removed;
>
>then when there is a memcpy() in the future, it will crash the engine.
>
>On Windows system, it tests IsBadReadPtr()to catch the exception as early as possible.
>
>But there is no such check (error handle) for Linux platform. I added a function to act as
>IsBadReadPtr() to catch the exception.
>
>
>
> After memory map exception (MMAP_EOF_EXCEPTION) occurred, the Read() function in
>common/fileio/platform/unix/mmapdatf.cpp
>
>will regress to normal_read. and it will consume some data which has been mapped in memory.
>
>then in CheckForCorruptFile() of filesystem/local/full/smplfsys.cpp, we should try to consider this
>situation.
>
>and in this scenario file size (m_ulSize) isn't initialized. We could determine it is a corrupt file
>depends on m_ulSize equal to 0.
>
>
>
>Files Added:
>
> No file added
>
>Files Modified:
>
> common/fileio/mmapmgr.cpp
>
> add function _IsBadReadPtr() to detect whether the file is available, and try to catch the
>exception due to device removed.
>
> filesystem/local/full/smplfsys.cpp
>
> file size (m_ulSize) equal to 0 means a corrupt file.
>
>
>
>Image Size and Heap Use impact (Client -Only):
>
> little
>
>Platforms and Profiles Affected:
>
> platform: linux-2.2-libc6-gcc32-i586
>
> profile: helix-client-all-defines
>
>
>
>Distribution Libraries Affected:
>
> <smplfsys.so>
>
>Distribution library impact and planned action:
>
> <None>
>
>Platforms and Profiles Build Verified:
>
> Set BIF branch -> hxclient_3_1_0_atlas_restricted
>
> Set Target(s) -> player_mid_all_installers (or splay)
>
> Set Profile -> helix-client-all-defines
>
> System ID -> linux-2.2-libc6-gcc32-i586
>
>Branch:
>
> HEAD
>
>Copyright assignment: <MUST be one of the following statements >
>
> 2. Intel has signed and delivered a Joint Copyright Assignment
>
> to RealNetworks, and received acknowledgment that the
>
> agreement was received.
>
>Files Attached:
>
> common-fileio-mmapmgr.cpp.diff.txt
>
> filesystem-local-smplsys.cpp.diff.txt
>
>
>
>ZHAO, Halley (Aihua)
>
>Email: [email protected] <mailto:[email protected]>
>
>Tel: +86(21)61166476
>
>iNet: 8821-6476
>
>SSG/OTC/UMD
>
>
_______________________________________________
Helix-client-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev