Some questions about compute shader

Hello, I have some questions about compute shader. My application contains function, in which invokes 2 compute shaders. First fills by some value 2D texture (RGBA32F) or SSBO (in function invoked for 2D texture and SSBO), second performs computations and uses prepaired by first shader texture and SSBO (contains loops, if statements (at this moment can’t rewrite without them)). In another function I read values from SSBO and texture by glMapBuffer and glGetTextureSubImage. All worked, before I started calling these functions in for loop. App began crashing after delay with STATUS_STACK_BUFFER_OVERRUN(0xC0000409) at the first occurrence of glMapBuffer/glGetTextureSubImage. If comment buffer and texture access functions (such as glMapBuffer/glGetTextureSubImage/glUnmapBuffer) app working without problem. So, to continue work around, I want to know something else about compute shader.

  1. Have to I call something else before reading from SSBO/texture modified by compute shader? (now I call only glMemoryBarrier with appropriate bit and bind buffer/texture)
  2. Have to I call something else after reading from SSBO/texture? (now only glUnmapBuffer if reading from SSBO)
  3. How should I invoke compute shader in such situation? (maybe I do something wrong: use shader - bind uniforms - glDispatchCompute - glMemoryBarrier - unuse shader)