Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-3245

couchjs -S option doesn't have any effect

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      currently -S option of couchjs sets stack chunk size for js contexts

      Reference: to https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_NewContext

      Documentation recommends 8K and I have seen cases where it was raised to 1G+ in production!. That doesn't seem right at all and also probably kills performance and eats memory.

      Docs from above say:

      > The stackchunksize parameter does not control the JavaScript stack size. (The JSAPI does not provide a way to adjust the stack depth limit.) Passing a large number for stackchunksize is a mistake. In a DEBUG build, large chunk sizes can degrade performance dramatically. The usual value of 8192 is recommended

      Instead we should be setting the max gc value which is set in the runtime

      JS_NewRuntime(uint32_t maxbytes)

      Experimentally a large maxbytes seems to fix out of memory error caused by large views. I suspect that it works because it stops GC. At some point we probably drops some object, GC collects them and we crash...

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              vatamane Nick Vatamaniuc
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: