Getting an “Out of memory” Nginx error when attempting to run Lancache on Raspberry Pi 3B












1















I have a Raspberry Pi 3B and want to run Lancache on it. I know the performance will not be very good as the Raspberry Pi only has Fast Ethernet and a mobile CPU.



The Docker image consists of three parts: Dnsmasq, Sniproxy and Nginx.
The first two are working fine, but Nginx exits with an error:



[alert] 1#1: mmap(MAP_ANON|MAP_SHARED, 268435456) failed (12: Out of memory)


The pi uses ~100MB ram from 940MB, so there shouldn't be a problem.
There is also enough disk space free.



What could be the reason for this error?










share|improve this question





























    1















    I have a Raspberry Pi 3B and want to run Lancache on it. I know the performance will not be very good as the Raspberry Pi only has Fast Ethernet and a mobile CPU.



    The Docker image consists of three parts: Dnsmasq, Sniproxy and Nginx.
    The first two are working fine, but Nginx exits with an error:



    [alert] 1#1: mmap(MAP_ANON|MAP_SHARED, 268435456) failed (12: Out of memory)


    The pi uses ~100MB ram from 940MB, so there shouldn't be a problem.
    There is also enough disk space free.



    What could be the reason for this error?










    share|improve this question



























      1












      1








      1


      2






      I have a Raspberry Pi 3B and want to run Lancache on it. I know the performance will not be very good as the Raspberry Pi only has Fast Ethernet and a mobile CPU.



      The Docker image consists of three parts: Dnsmasq, Sniproxy and Nginx.
      The first two are working fine, but Nginx exits with an error:



      [alert] 1#1: mmap(MAP_ANON|MAP_SHARED, 268435456) failed (12: Out of memory)


      The pi uses ~100MB ram from 940MB, so there shouldn't be a problem.
      There is also enough disk space free.



      What could be the reason for this error?










      share|improve this question
















      I have a Raspberry Pi 3B and want to run Lancache on it. I know the performance will not be very good as the Raspberry Pi only has Fast Ethernet and a mobile CPU.



      The Docker image consists of three parts: Dnsmasq, Sniproxy and Nginx.
      The first two are working fine, but Nginx exits with an error:



      [alert] 1#1: mmap(MAP_ANON|MAP_SHARED, 268435456) failed (12: Out of memory)


      The pi uses ~100MB ram from 940MB, so there shouldn't be a problem.
      There is also enough disk space free.



      What could be the reason for this error?







      raspberry-pi nginx raspbian reverse-proxy memory-error






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 5 at 16:59









      JakeGould

      31.3k1096138




      31.3k1096138










      asked Jan 5 at 16:32









      ComanderKai77ComanderKai77

      82




      82






















          2 Answers
          2






          active

          oldest

          votes


















          0














          When you look at the nginx configuration (data/conf/*.nginx.conf) in this project, you will find the following lines:



          proxy_cache_path /cache/arenanet keys_zone=arenanet:256m levels=1:2:2 inactive=365d;


          This will result in nginx allocating 256 MiB (268435456 bytes) of memory to manage this cache. This is what fails.



          Now, there are 13 of these statements, one for each service supported. In total, this requires 3.25 GiB of memory. That may add up to more than the 32-bit address space can deliver, with or without swap. It simply cannot work.



          You need to either modify this configuration, reducing the size of the key cache (and thus the maximum amount of cached objects), or use a 64-bit operating system (luckily, the Pi 3 has a 64-bit CPU). Still, without real RAM to back these caches, things will be extremely slow.






          share|improve this answer

































            0














            One thing to try that I can think of is try increasing your swap space on your Raspberry Pi.



            The swap file config is located at:



            /etc/dphys-swapfile


            The variable you're going to want to change is named "CONF_SWAPSIZE". It should have a default value of 100, try increasing it to 2048 (2GB) to see if it fixes your issue.



            Here's a little script I made for increasing the swap size:



            sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
            sudo /etc/init.d/dphys-swapfile stop
            sudo /etc/init.d/dphys-swapfile start


            To set the swap size back to normal:



            sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=100/' /etc/dphys-swapfile
            sudo /etc/init.d/dphys-swapfile stop
            sudo /etc/init.d/dphys-swapfile start


            Note that increasing your swap size is a good way to wear out your SD card, so this may not be the best solution for the long run.






            share|improve this answer
























            • I've tried it and nothing changed. The maximum memory usage is ~100MB and the Sawp is never in use.

              – ComanderKai77
              Jan 5 at 18:59











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390932%2fgetting-an-out-of-memory-nginx-error-when-attempting-to-run-lancache-on-raspbe%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            When you look at the nginx configuration (data/conf/*.nginx.conf) in this project, you will find the following lines:



            proxy_cache_path /cache/arenanet keys_zone=arenanet:256m levels=1:2:2 inactive=365d;


            This will result in nginx allocating 256 MiB (268435456 bytes) of memory to manage this cache. This is what fails.



            Now, there are 13 of these statements, one for each service supported. In total, this requires 3.25 GiB of memory. That may add up to more than the 32-bit address space can deliver, with or without swap. It simply cannot work.



            You need to either modify this configuration, reducing the size of the key cache (and thus the maximum amount of cached objects), or use a 64-bit operating system (luckily, the Pi 3 has a 64-bit CPU). Still, without real RAM to back these caches, things will be extremely slow.






            share|improve this answer






























              0














              When you look at the nginx configuration (data/conf/*.nginx.conf) in this project, you will find the following lines:



              proxy_cache_path /cache/arenanet keys_zone=arenanet:256m levels=1:2:2 inactive=365d;


              This will result in nginx allocating 256 MiB (268435456 bytes) of memory to manage this cache. This is what fails.



              Now, there are 13 of these statements, one for each service supported. In total, this requires 3.25 GiB of memory. That may add up to more than the 32-bit address space can deliver, with or without swap. It simply cannot work.



              You need to either modify this configuration, reducing the size of the key cache (and thus the maximum amount of cached objects), or use a 64-bit operating system (luckily, the Pi 3 has a 64-bit CPU). Still, without real RAM to back these caches, things will be extremely slow.






              share|improve this answer




























                0












                0








                0







                When you look at the nginx configuration (data/conf/*.nginx.conf) in this project, you will find the following lines:



                proxy_cache_path /cache/arenanet keys_zone=arenanet:256m levels=1:2:2 inactive=365d;


                This will result in nginx allocating 256 MiB (268435456 bytes) of memory to manage this cache. This is what fails.



                Now, there are 13 of these statements, one for each service supported. In total, this requires 3.25 GiB of memory. That may add up to more than the 32-bit address space can deliver, with or without swap. It simply cannot work.



                You need to either modify this configuration, reducing the size of the key cache (and thus the maximum amount of cached objects), or use a 64-bit operating system (luckily, the Pi 3 has a 64-bit CPU). Still, without real RAM to back these caches, things will be extremely slow.






                share|improve this answer















                When you look at the nginx configuration (data/conf/*.nginx.conf) in this project, you will find the following lines:



                proxy_cache_path /cache/arenanet keys_zone=arenanet:256m levels=1:2:2 inactive=365d;


                This will result in nginx allocating 256 MiB (268435456 bytes) of memory to manage this cache. This is what fails.



                Now, there are 13 of these statements, one for each service supported. In total, this requires 3.25 GiB of memory. That may add up to more than the 32-bit address space can deliver, with or without swap. It simply cannot work.



                You need to either modify this configuration, reducing the size of the key cache (and thus the maximum amount of cached objects), or use a 64-bit operating system (luckily, the Pi 3 has a 64-bit CPU). Still, without real RAM to back these caches, things will be extremely slow.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 6 at 11:18

























                answered Jan 5 at 19:26









                Daniel BDaniel B

                33.8k76387




                33.8k76387

























                    0














                    One thing to try that I can think of is try increasing your swap space on your Raspberry Pi.



                    The swap file config is located at:



                    /etc/dphys-swapfile


                    The variable you're going to want to change is named "CONF_SWAPSIZE". It should have a default value of 100, try increasing it to 2048 (2GB) to see if it fixes your issue.



                    Here's a little script I made for increasing the swap size:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    To set the swap size back to normal:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=100/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    Note that increasing your swap size is a good way to wear out your SD card, so this may not be the best solution for the long run.






                    share|improve this answer
























                    • I've tried it and nothing changed. The maximum memory usage is ~100MB and the Sawp is never in use.

                      – ComanderKai77
                      Jan 5 at 18:59
















                    0














                    One thing to try that I can think of is try increasing your swap space on your Raspberry Pi.



                    The swap file config is located at:



                    /etc/dphys-swapfile


                    The variable you're going to want to change is named "CONF_SWAPSIZE". It should have a default value of 100, try increasing it to 2048 (2GB) to see if it fixes your issue.



                    Here's a little script I made for increasing the swap size:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    To set the swap size back to normal:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=100/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    Note that increasing your swap size is a good way to wear out your SD card, so this may not be the best solution for the long run.






                    share|improve this answer
























                    • I've tried it and nothing changed. The maximum memory usage is ~100MB and the Sawp is never in use.

                      – ComanderKai77
                      Jan 5 at 18:59














                    0












                    0








                    0







                    One thing to try that I can think of is try increasing your swap space on your Raspberry Pi.



                    The swap file config is located at:



                    /etc/dphys-swapfile


                    The variable you're going to want to change is named "CONF_SWAPSIZE". It should have a default value of 100, try increasing it to 2048 (2GB) to see if it fixes your issue.



                    Here's a little script I made for increasing the swap size:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    To set the swap size back to normal:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=100/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    Note that increasing your swap size is a good way to wear out your SD card, so this may not be the best solution for the long run.






                    share|improve this answer













                    One thing to try that I can think of is try increasing your swap space on your Raspberry Pi.



                    The swap file config is located at:



                    /etc/dphys-swapfile


                    The variable you're going to want to change is named "CONF_SWAPSIZE". It should have a default value of 100, try increasing it to 2048 (2GB) to see if it fixes your issue.



                    Here's a little script I made for increasing the swap size:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=2048/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    To set the swap size back to normal:



                    sudo sed -i -e 's/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=100/' /etc/dphys-swapfile
                    sudo /etc/init.d/dphys-swapfile stop
                    sudo /etc/init.d/dphys-swapfile start


                    Note that increasing your swap size is a good way to wear out your SD card, so this may not be the best solution for the long run.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 5 at 18:50









                    snarpsnarp

                    111




                    111













                    • I've tried it and nothing changed. The maximum memory usage is ~100MB and the Sawp is never in use.

                      – ComanderKai77
                      Jan 5 at 18:59



















                    • I've tried it and nothing changed. The maximum memory usage is ~100MB and the Sawp is never in use.

                      – ComanderKai77
                      Jan 5 at 18:59

















                    I've tried it and nothing changed. The maximum memory usage is ~100MB and the Sawp is never in use.

                    – ComanderKai77
                    Jan 5 at 18:59





                    I've tried it and nothing changed. The maximum memory usage is ~100MB and the Sawp is never in use.

                    – ComanderKai77
                    Jan 5 at 18:59


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1390932%2fgetting-an-out-of-memory-nginx-error-when-attempting-to-run-lancache-on-raspbe%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Plaza Victoria

                    In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                    How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...