Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4459640

Java crash with a load of more than 20 users, assertion on fontObject.cpp



    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.3.0, 1.3.1, 1.3.1_03, 1.4.0
    • Fix Version/s: 1.3.1_04
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
    • CPU:
    • OS:
      solaris_7, solaris_8



        ingrid.yao@Eng 2001-05-16

        java crash with a load of more than 20 users with CAP member's apps.
        Attach the stack trace dump file - font_assert.txt.

        bug description:

        J2SE Version (please include all output from java -version flag):
        java version "1.4.0-Beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b62)
        Java HotSpot(TM) Client VM (build 1.4.0-beta-b62, mixed mode)

        Does this problem occur on J2SE 1.3? Yes / No (pick one)

        Operating System Configuration Information (be specific):
        Solaris 2.7

        Hardware Configuration Information (be specific):
        Sun 420R Quad Processor 1 GIG Mem

        Bug Description:
        This occurs with a load of 25 users with Silk Performer. Using fewer
        simulated users (20) without any stability problems.

        Looked at the C++ source code referenced by the assertion from
        the stack trace. This comes from the readBlock method(see attached code)

        Note that the comment for the method suggests it is a "light-weight" version
        of read chunk, and it certainly appears that the code was a "cut and paste"
        from that method, and then logic from the original method was removed. Also
        note that the readChunk method seems to pay careful attention to the file
        use count, and is properly incrementing and decrementing that value, but this
        logic seems incomplete and inconsistent in readBlock. Finally note that
        readChunk has commented out the assert(fFile) line that we are stumbling
        across in readBlock. Can Java2D team provide some insight on whether
        the existing logic is correct, and/or how we are getting into this case,
        so be able to quickly generate an isolated test case.

        --- fontObject.cpp------
        //- Light-weight ReadChunk
        void fileFontObject::readBlock(size_t offset, size_t size, char *dest)
            if (fUseCount == 0) {
                fFile = fopen(fFontLocalPlatformName, "rb");
                assert(fFile); <---Assertion happen
                assert(ferror(fFile) == 0);
                if (fFileSize == 0) {
                    fseek(fFile, 0, SEEK_END);
                    fFileSize = ftell(fFile);

            assert(size > 0);

           if (((size_t)ftell(fFile)) != offset) {
                int error = fseek(fFile, offset, SEEK_SET);
                assert (error == 0);
            size_t count = fread(dest, sizeof(char), size, fFile);
            assert(ferror(fFile) == 0 && count == (size_t) size);

            if (fUseCount == 0) {
                fFile = NULL;
            else {

        const void* fileFontObject::ReadChunk(UInt32 offset, UInt32 length,
                                              void* chunk)
        #ifdef PRINT_INFO
            fprintf(stderr, "ReadChunk(%d, %d, %X)\n", offset, length, chunk);
            char* data = (char*)chunk;

            if (fUseCount == 0) {
                fFile = fopen(fFontLocalPlatformName, "rb");
                if (fFile == NULL || ferror(fFile) != 0) {
        // assert(fFile); <----why comment out these lines????
        // assert(ferror(fFile) == 0);
                    return NULL;
                if (fFileSize == 0) {
                    fseek(fFile, 0, SEEK_END);
                    fFileSize = ftell(fFile);
            fUseCount += 1;

            if (length > 0 && fFileSize > 0) {
                assert(offset < fFileSize);
                if ((offset + length) > fFileSize)
                    length = fFileSize - offset;

                if (data == nil) {
                    data = new char[length];

                if( nil == data ) {
        #ifdef DEBUG
                          stderr,"new returns nil, fontObject.cpp,%s\n",
                  return NULL;

                int err = fseek(fFile, offset, SEEK_SET);
                if (err) {
                    fprintf(stderr, "fseek(%ld) returned %d\n", offset, err);

                size_t bytesRead = fread(data, sizeof(char),length, fFile);
                if (bytesRead != length) {
                    err = ferror(fFile);
                    int tellvalue = ftell(fFile);
        #ifdef DEBUG
                            "<%s> of %ld, ln %ld, rd %ld, sz %ld, tell %d, err %d\n",
                            (char *)fFileName, offset, length, bytesRead,
                            fFileSize, tellvalue, err);

            // If the caller provided the chunk, call release with nil
            // to decrement the usecount, since the caller won't call
            // release.
            if (chunk) {
            return data;


            Issue Links



                prr Philip Race
                tyao Ting-Yun Ingrid Yao (Inactive)
                0 Vote for this issue
                0 Start watching this issue