Giter VIP home page Giter VIP logo

Comments (10)

agentzh avatar agentzh commented on July 27, 2024 1

@mohsininayatkhan Seems like you are running the commands in a wrong context where no code is running? Maybe starting your Lua app and break in the middle (like hitting Ctrl-C in the gdb session while executing the "start" or "continue" gdb commands or setting a breakpoint yourself).

from openresty-gdb-utils.

mohsininayatkhan avatar mohsininayatkhan commented on July 27, 2024

Thanks @agentzh for your reply.

Basically I have OpenResty installed on the machine and observed that there are some memory leaks while downloading a large size file through http request using

https://github.com/caquino/ranger

Can you please help me how can I debug it to find the problem area.

Thanks

from openresty-gdb-utils.

agentzh avatar agentzh commented on July 27, 2024

@mohsininayatkhan Maybe it's not really a memory leak but just that the default GC pace is not enough for your usage, hence the temporary memory usage spikes. Maybe you could consider using streaming processing for large responses (instead of fully buffering everything in memory at once) and/or adjust the LuaJIT GC parameters (like "setpause"). Or maybe your Lua code has memory leaks (like an ever growing globally shared Lua table or Lua string).

BTW, the lgcstat and lgcpath commands provided by this project are particularly useful in debugging GC-managed memory issues.

from openresty-gdb-utils.

mohsininayatkhan avatar mohsininayatkhan commented on July 27, 2024

is it save to call collectgarbage("collect") at the end of lua code?
Please suggest

from openresty-gdb-utils.

agentzh avatar agentzh commented on July 27, 2024

Tuning "setpause" is safer since "collect" is very expensive since it enforces full GC cycles.

from openresty-gdb-utils.

agentzh avatar agentzh commented on July 27, 2024

But still, avoiding allocating too many short-lived Lua GC objects (closures, tables, strings, and etc) in your own Lua code logic can be much much more effective and efficient. Tuning the GC parameters should only be the last resort.

from openresty-gdb-utils.

mohsininayatkhan avatar mohsininayatkhan commented on July 27, 2024

customized the following code

https://github.com/caquino/ranger/blob/master/content.lua

to generate chunks

from openresty-gdb-utils.

agentzh avatar agentzh commented on July 27, 2024

@mohsininayatkhan Sorry, still too large for me to follow quickly.

from openresty-gdb-utils.

mohsininayatkhan avatar mohsininayatkhan commented on July 27, 2024

Hello @agentzh, is there any step-by-step help available regarding how to debug code using this tool?

from openresty-gdb-utils.

agentzh avatar agentzh commented on July 27, 2024

@mohsininayatkhan Please let me know how I can improve the existing documentation of this project. I tried to give you those detailed gdb steps above but it seems that you still failed to follow. Alas.

from openresty-gdb-utils.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.