Closed Bug 401138 Opened 17 years ago Closed 17 years ago

Raise file descriptor limit

Categories

(Camino Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Camino1.6

People

(Reporter: stuart.morgan+bugzilla, Assigned: stuart.morgan+bugzilla)

Details

(Keywords: fixed1.8.1.10, Whiteboard: [camino-1.5.3])

Attachments

(1 file, 1 obsolete file)

Attached patch limit boost (obsolete) — Splinter Review
Bug 397053 puts us in a nasty position, because anyone who visits enough pages with Flash will eventually lose all functionality in Camino, and we can't fix it. Until we can get more traction on a real fix, boosting our fd limit to 1024 will at least make this less painful for our users.
Attachment #286190 - Flags: review?(mark)
Comment on attachment 286190 [details] [diff] [review]
limit boost

Looks good to me with the following changes:

>Index: src/application/main.m

>+#include <sys/resource.h>

Looking at the 10.2 SDK, you need to #include <sys/types.h> too.

>+static void SetMaxFileDescriptors(int target_max)

Call the argument "target" - it's slightly confusing to call it target_max but to use it for rlim_cur (instead of rlim_max).

>+{
>+  struct rlimit rlp;

"p" means pointer, which this isn't.  Call it rl or something else.

>+  if (getrlimit(RLIMIT_NOFILE, &rlp) == 0) {
>+    if (rlp.rlim_max > 0 && rlp.rlim_max < target_max)
>+      target_max = rlp.rlim_max;
>+    if (target_max > rlp.rlim_cur) {
>+      rlp.rlim_cur = target_max;
>+      setrlimit(RLIMIT_NOFILE, &rlp);
>+    }
>+  }
>+}
>+
> int main(int argc, const char *argv[])
> {
>   SetupRuntimeOptions(argc, argv);

Put a blank line here, so it's clear that the comment applies to SetMaxFileDescriptors.

>+  // Because of a nasty file descriptor leak when viewing flash
>+  // (bug 397053), bump up our limit up to 1024 so that it takes longer for
>+  // the world to end.
>+  SetMaxFileDescriptors(1024);
Attachment #286190 - Flags: review?(mark) → review+
Attached patch v2Splinter Review
addresses comments
Attachment #286190 - Attachment is obsolete: true
Attachment #286192 - Flags: superreview?
Comment on attachment 286192 [details] [diff] [review]
v2

sr=pink
Attachment #286192 - Flags: superreview? → superreview+
Checked in, cuz I gots da treez.
Status: NEW → RESOLVED
Closed: 17 years ago
Keywords: fixed1.8.1.10
Resolution: --- → FIXED
Whiteboard: [camino-1.5.3]
I checked in a bustage fix for this on the 1_5 and 1_8 branches; 10.3.x SDK requires 

#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: