BFD Error when Loading an Oracle Table

Alan Modra amodra@bigpond.net.au
Wed Oct 26 02:05:00 GMT 2005


[Regarding   BFD: BFD 2.15.93 20041018 internal error, aborting at
 cache.c line 495 in bfd_cache_lookup_worker]

On Wed, Oct 26, 2005 at 10:15:26AM +0930, Alan Modra wrote:
> The BFD error is most likely due to the operating system returning an
> error, "Too many open files".  I'm guessing from the dump you show
> below that gdb is being invoked by the checkpoint process in order to
> debug some other serious problem.
> 
> I see there are a number of open gdb reports about this problem, so it
> looks to me like gdb is failing to close files for some reason.  BFD
> will manage files, closing and reopening as needed to avoid this sort of
> system limit, but only if files are opened by BFD.  If an open file
> descriptor is passed to BFD, then BFD assumes that the caller will
> manage files.  (grep for cacheable in bfd/opncls.c).

Hmm, on looking over the code in bfd_cache_lookup_worker, I see we
unnecessarily limit the file position on systems that provide fseeko64
and ftello64.  So you might be hitting a file size limit.  I'm applying
the following patch to remove this limit and to provide better
diagnostics.

	* cache.c (bfd_open_file): Set bfd_error_system_call on failure
	to open file.
	(bfd_cache_lookup_worker): Remove check that file pos is in
	unsigned long range.  Print system error before aborting.

Index: bfd/cache.c
===================================================================
RCS file: /cvs/src/src/bfd/cache.c,v
retrieving revision 1.21
diff -c -p -r1.21 cache.c
*** bfd/cache.c	5 Oct 2005 21:24:23 -0000	1.21
--- bfd/cache.c	26 Oct 2005 01:54:15 -0000
*************** bfd_open_file (bfd *abfd)
*** 447,453 ****
        break;
      }
  
!   if (abfd->iostream != NULL)
      {
        if (! bfd_cache_init (abfd))
  	return NULL;
--- 447,455 ----
        break;
      }
  
!   if (abfd->iostream == NULL)
!     bfd_set_error (bfd_error_system_call);
!   else
      {
        if (! bfd_cache_init (abfd))
  	return NULL;
*************** bfd_cache_lookup_worker (bfd *abfd)
*** 489,502 ****
  	  snip (abfd);
  	  insert (abfd);
  	}
      }
    else
!     {
!       if (bfd_open_file (abfd) == NULL
! 	  || abfd->where != (unsigned long) abfd->where
! 	  || real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
! 	abort ();
!     }
  
!   return (FILE *) abfd->iostream;
  }
--- 491,507 ----
  	  snip (abfd);
  	  insert (abfd);
  	}
+       return (FILE *) abfd->iostream;
      }
+ 
+   if (bfd_open_file (abfd) == NULL)
+     ;
+   else if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
+     bfd_set_error (bfd_error_system_call);
    else
!     return (FILE *) abfd->iostream;
  
!   bfd_perror ("Cannot continue");
!   abort ();
!   return NULL;
  }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list