Re: BFD Error when Loading an Oracle Table

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: BFD Error when Loading an Oracle Table

Alan Modra
[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
Reply | Threaded
Open this post in threaded view
|

Re: BFD Error when Loading an Oracle Table

Alan Modra
On Wed, Oct 26, 2005 at 11:35:43AM +0930, Alan Modra wrote:
> !   bfd_perror ("Cannot continue");
> !   abort ();
> !   return NULL;

That wasn't such a good patch.  This should give a better idea of what
is going awry.

        * cache.c (bfd_cache_lookup_worker): Use bfd_error_handler
        rather than bfd_perror.  Print file name.  Internationalise.

Index: bfd/cache.c
===================================================================
RCS file: /cvs/src/src/bfd/cache.c,v
retrieving revision 1.22
diff -u -p -r1.22 cache.c
--- bfd/cache.c 26 Oct 2005 04:29:53 -0000 1.22
+++ bfd/cache.c 26 Oct 2005 07:30:02 -0000
@@ -477,6 +477,7 @@ DESCRIPTION
 FILE *
 bfd_cache_lookup_worker (bfd *abfd)
 {
+  bfd *orig_bfd = abfd;
   if ((abfd->flags & BFD_IN_MEMORY) != 0)
     abort ();
 
@@ -501,7 +502,8 @@ bfd_cache_lookup_worker (bfd *abfd)
   else
     return (FILE *) abfd->iostream;
 
-  bfd_perror ("Cannot continue");
+  (*_bfd_error_handler) (_("reopening %B: %s\n"),
+ orig_bfd, bfd_errmsg (bfd_get_error ()));
   abort ();
   return NULL;
 }

--
Alan Modra
IBM OzLabs - Linux Technology Centre