git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Retry if fdopen() fails due to ENOMEM
@ 2015-03-05 16:07 Michael Haggerty
  2015-03-05 16:07 ` [PATCH 1/5] xfdopen(): if first attempt fails, free memory and try again Michael Haggerty
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Michael Haggerty @ 2015-03-05 16:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonathan Nieder, git, Michael Haggerty

One likely reason for fdopen() to fail is the lack of memory for
allocating a FILE structure. When that happens, try freeing some
memory and calling fdopen() again in the hope that it will work the
second time.

This change was suggested by Jonathan Nieder [1]

In the first patch it is unsatisfying that try_to_free_routine() is
called with a magic number (1000) rather than sizeof(FILE). But the C
standard doesn't guarantee that FILE is a complete type, so I can't
think of a better approach. Suggestions, anybody?

Michael

[1] http://article.gmane.org/gmane.comp.version-control.git/260848

Michael Haggerty (5):
  xfdopen(): if first attempt fails, free memory and try again
  fdopen_lock_file(): use fdopen_with_retry()
  copy_to_log(): use fdopen_with_retry()
  update_info_file(): use fdopen_with_retry()
  buffer_fdinit(): use fdopen_with_retry()

 daemon.c              |  4 ++--
 git-compat-util.h     | 11 +++++++++++
 lockfile.c            |  2 +-
 server-info.c         |  2 +-
 vcs-svn/line_buffer.c |  2 +-
 wrapper.c             | 28 +++++++++++++++++++++++++---
 6 files changed, 41 insertions(+), 8 deletions(-)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-03-17 22:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-05 16:07 [PATCH 0/5] Retry if fdopen() fails due to ENOMEM Michael Haggerty
2015-03-05 16:07 ` [PATCH 1/5] xfdopen(): if first attempt fails, free memory and try again Michael Haggerty
2015-03-05 16:59   ` Stefan Beller
2015-03-05 19:06   ` Junio C Hamano
2015-03-05 16:07 ` [PATCH 2/5] fdopen_lock_file(): use fdopen_with_retry() Michael Haggerty
2015-03-05 16:07 ` [PATCH 3/5] copy_to_log(): " Michael Haggerty
2015-03-05 16:07 ` [PATCH 4/5] update_info_file(): " Michael Haggerty
2015-03-05 16:07 ` [PATCH 5/5] buffer_fdinit(): " Michael Haggerty
2015-03-05 19:19 ` [PATCH 0/5] Retry if fdopen() fails due to ENOMEM Junio C Hamano
2015-03-10 11:42   ` Michael Haggerty
2015-03-06  5:08 ` Torsten Bögershausen
2015-03-10 11:44   ` Michael Haggerty
2015-03-17 22:32     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).