Error when try to debug with docker-compose

Answered

Hello,

I'm using docker-compose with RubyMine 2019.1.2. My docker-compose has many services like nginx, postgresQL, redis, my ruby application and so on.

I could've added the remote interpreter for this docker-compose by following this tutorial(). However I'm getting below error whenever I try to start debug.

'Uncaught exception: Circular dependency detected while autoloading constant **********'

Besides, it spits out a different connection error when I try it with 'docker-compose up' option in 'Run/Debug Configuration". Here is the error.

30: connection failed(2)
myapplication | Exception: Connection refused - connect(2) for "172.26.0.1" port 26168
myapplication | /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.7.0/lib/ruby-debug-ide.rb:168:in `initialize'
myapplication | /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.7.0/lib/ruby-debug-ide.rb:168:in `open'
myapplication | /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.7.0/lib/ruby-debug-ide.rb:168:in `block in notify_dispatcher_if_needed'
myapplication | /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.7.0/lib/ruby-debug-ide.rb:166:in `times'
myapplication | /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.7.0/lib/ruby-debug-ide.rb:166:in `notify_dispatcher_if_needed'
myapplication | /usr/local/lib/ruby/gems/2.3.0/gems/ruby-debug-ide-0.7.0/lib/ruby-debug-ide.rb:123:in `block in start_control'

Could you give me any hints to solve this problem?

Thanks

6 comments

Hello,

could you please check how it goes in RubyMine 2019.2 EAP? In addition, does debugging work for a plain Ruby script? Which tutorial have you followed? 

0

Hi,

Yes, it works well with your sample project.

And I've figured out the solution for 'connection refused' error. It was occurred because the rails ran in cluster mode. So I've changed it to work as single mode, and the error is gone.

Yet, I am still struggling with 'Circular dependency' error. I've found out RubyMine creates a temporary 'docker-compose' file under '~/Library/Caches/RubyMine2019.1/tmp/' whenever I execute 'debug configuration'. And that file is different with my original 'docker-compose' file.

The temporary 'docker-compose' file tries to mount my volume which is created by 'docker-sync' to '/opt/project', and this is not what I expected. So my application container has 2 identical(linked?) application code directories. And that is the reason why 'Circular dependency' error happens. I still couldn't find a work around this.

Could you give me any hints for this?

------ updated -----

part of my docker-compose.yml

if I use commented volume then it works, however if I use uncommented volume then it tries to mount to '/opt/project/' and occurs 'Circular dependency' error.

myapplication:
build:
context: .
volumes:
#- .:/workspace/myapplication
- type: volume
source: myapplication-dir
target: "/workspace/myapplication"
volume:
nocopy: true

volumes:
myapplication-dir:
external: true

 

docker-sync.yml

version: 2
options:
verbose: true
proejct_root: '${myapplication_dir}'
syncs:
myapplication-dir:
src: '${myapplication_dir}'
sync_excludes: ['.git', 'tmp', 'log', 'node_modules', '*.tmp']
sync_strategy: 'native_osx'
0

Hello,

just to be sure, so does debugger work with a plain Ruby script or in the sample that is attached to the tutorial?

0

Hello,

I haven't tried debugger with other ruby scripts, but just tried the sample project in this tutorial(https://www.jetbrains.com/help/ruby/2019.1/using-docker-as-a-remote-interpreter.html) and my project. Everything was fine with the sample project in the tutorial.

However I'm facing troubles which I described above with my project. But I could success to debug with my project, if I don't use the volume which is created via docker-sync.

0

Hello,

I found this topic(https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000008870-Understanding-Stealth-Volume-Mapping-of-opt-projects), and it seems a quite similar situation with me in terms of all of sudden appearance of '/opt/project/'. Is this a bug or intended work?

Thanks.

0

Hello,

have you tried using 2019.2 EAP? In 2019.2 we don't replace mapping `/opt/project` in case we managed to understand the one from docker-compose.yml of the project.

0

Please sign in to leave a comment.