Results 1 to 8 of 8

Thread: QFile::read failing on XP SP3

  1. #1
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QFile::read failing on XP SP3

    I am trying to read a 131MB file on windows XP into a buffer I allocated and I am getting the following error.

    "Insufficient system resources exist to complete the requested service."

    I see in the Qt4.4 source code that the reads are limited to 32MB to try to avoid this problem however I am still hitting it when the source is a network drive. I guess I could ask for even smaller chunks but I need the read to be reliable.

    Ideas? Solutions / workarounds?
    Last edited by drescherjm; 7th April 2009 at 21:56.
    John

  2. #2
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile::read failing on XP SP3

    I made my max read size at 1 MB but this makes me nervous.
    John

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile::read failing on XP SP3

    That's a Windows error, not a Qt one (QFile::read just uses winapi).
    http://support.microsoft.com/kb/913872

  4. #4
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile::read failing on XP SP3

    I expected as much. Especially that it was not fixed in 3 years!

    Looks like I will be extending the QFile class to deal with this..

    Specifically I will override

    QIODevice::readData

    with my own function to workaround the windows bug..

    BTW, this does not seem to happen on writes since Qt happily created the 131MB file in one call to QIODevice::write(buff,size);
    John

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile::read failing on XP SP3

    That's not gonna do it. The workaround suggested you use FILE_FLAG_NO_BUFFERING when you open the file (with CreateFile).
    You can then use ReadFile to read data.

    Not really necessary to subclass QIODevice, unless you're building the app for other platforms than win.

  6. The following user says thank you to marcel for this useful post:

    drescherjm (8th April 2009)

  7. #6
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile::read failing on XP SP3

    Quote Originally Posted by marcel View Post
    Not really necessary to subclass QIODevice, unless you're building the app for other platforms than win.
    I am building the application for linux and windows and in the future Macintosh. With my build system I can easily have any kludges compiled in or out depending on the system.
    John

  8. #7
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile::read failing on XP SP3

    Quote Originally Posted by marcel View Post
    That's not gonna do it. The workaround suggested you use FILE_FLAG_NO_BUFFERING when you open the file (with CreateFile).
    You can then use ReadFile to read data.
    I know. I am going to look into the ramifications of doing that before I make it permanent.
    John

  9. #8
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QFile::read failing on XP SP3

    BTW,

    The windows version of the same code is failing in the _read() in the same way on the same input file as expected..
    John

Similar Threads

  1. Trying to Install Qt 4.5 on Vista32 with MSVC++ 2008 Express: and Failing
    By GregMalick in forum Installation and Deployment
    Replies: 9
    Last Post: 30th June 2010, 06:35
  2. Failing Builds in msvc2005 -> QT4.4.3
    By plitanium in forum Installation and Deployment
    Replies: 4
    Last Post: 2nd March 2009, 12:39
  3. Qt Failing to Recognize Tablet Pen Clicks Correctly
    By Cris987 in forum Qt Programming
    Replies: 0
    Last Post: 26th August 2008, 01:41
  4. I'm failing with Threading
    By thomaspu in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2008, 19:40
  5. Qt 4.1 install failing on Linux
    By Maxilys in forum Installation and Deployment
    Replies: 11
    Last Post: 14th January 2006, 15:39

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.