seattlerb / ruby_parser

ruby_parser is a ruby parser written in pure ruby. It outputs s-expressions which can be manipulated and converted back to ruby via the ruby2ruby gem.
http://www.zenspider.com/projects/ruby_parser.html
476 stars 100 forks source link

Forced $DEBUG output after 3.10.0 to 3.10.1 upgrade #258

Closed smlsml closed 6 years ago

smlsml commented 6 years ago

After upgrading the gem from 3.10.0 to 3.10.1, I'm now getting a ton of output that was never there before. I could see this being useful during a deep debug perhaps, but not on by default.

Any ideas? Downgrading back to 3.10.0 makes this go away.

Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251 - cannot load such file -- 2.3.5/ruby_prof.so
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:240 - cannot load such file -- 2.3.5/ruby_prof.so
Exception `Errno::ENOENT' at /Users/slawson/code/manager/manager/config/application.rb:30 - No such file or directory @ rb_sysopen - config/svmanager.yml
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251 - cannot load such file -- idn
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:240 - cannot load such file -- idn
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251 - cannot load such file -- idn
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:240 - cannot load such file -- idn
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251 - cannot load such file -- fast_xs
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:240 - cannot load such file -- fast_xs
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251 - cannot load such file -- data_mapper
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:240 - cannot load such file -- data_mapper
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251 - cannot load such file -- mongoid
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:240 - cannot load such file -- mongoid
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validators' not defined in #<Class:0x00007f981df20050>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_initialize_callbacks' not defined in #<Class:0x00007f981df20050>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_save_callbacks' not defined in #<Class:0x00007f981df20050>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_find_callbacks' not defined in #<Class:0x00007f981df20050>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validate_callbacks' not defined in #<Class:0x00007f981df20050>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validators' not defined in #<Class:0x00007f981fa212c8>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_accessible_attributes' not defined in #<Class:0x00007f981fa212c8>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_active_authorizer' not defined in #<Class:0x00007f981fa212c8>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_save_callbacks' not defined in #<Class:0x00007f981fa212c8>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validators' not defined in #<Class:0x00007f981f04b668>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `reflections' not defined in #<Class:0x00007f981f04b668>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_save_callbacks' not defined in #<Class:0x00007f981f04b668>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validate_callbacks' not defined in #<Class:0x00007f981f04b668>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validation_callbacks' not defined in #<Class:0x00007f981f04b668>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validators' not defined in #<Class:0x00007f981eee30f0>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_save_callbacks' not defined in #<Class:0x00007f981eee30f0>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_destroy_callbacks' not defined in #<Class:0x00007f981eee30f0>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `reflections' not defined in #<Class:0x00007f981eee30f0>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_create_callbacks' not defined in #<Class:0x00007f981eee30f0>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_update_callbacks' not defined in #<Class:0x00007f981eee30f0>
Exception `NameError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/core_ext/module/remove_method.rb:4 - method `_validate_callbacks' not defined in #<Class:0x00007f981eee30f0>

It even outputs http traffic:

-> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<RetrievePropertiesResponse xmlns=\"urn:vim25\"><returnval><obj type=\"Datastore\">datastore-11</obj><propSet><name>summary</name><val xsi:type=\"DatastoreSummary\"><datastore type=\"Datastore\">datastore-11</datastore><name>dev1-datastore-01</name><url>ds:///vmfs/volumes/54f0b4da-b7fe48d8-234a-b083fee5945a/</url><capacity>291252469760</capacity><freeSpace>249831620608</freeSpace><uncommitted>144411224082</uncommitted><accessible>true</accessible><multipleHostAccess>false</multipleHostAccess><type>VMFS</type><maintenanceMode>normal</maintenanceMode></val></propSet></returnval></RetrievePropertiesResponse>\n</soapenv:Body>\n</soapenv:Envelope>"
read 931 bytes
Conn keep-alive
<- "POST /sdk HTTP/1.1\r\nContent-Type: text/xml; charset=utf-8\r\nSoapaction: urn:vim25/6.0\r\nCookie: vmware_soap_session=\"xxxxxxxxxxx\"; Path=/; HttpOnly; Secure;\r\nAccept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3\r\nAccept: */*\r\nUser-Agent: Ruby\r\nHost: dev1-av-vc.eng.vmware.com\r\nContent-Length: 544\r\n\r\n"
<- "<env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><env:Body><RetrieveProperties xmlns=\"urn:vim25\"><_this type=\"PropertyCollector\">propertyCollector</_this><specSet xsi:type=\"PropertyFilterSpec\"><propSet xsi:type=\"PropertySpec\"><type>Datacenter</type><pathSet>name</pathSet></propSet><objectSet xsi:type=\"ObjectSpec\"><obj type=\"Datacenter\">datacenter-46</obj></objectSet></specSet></RetrieveProperties></env:Body></env:Envelope>"
-> "HTTP/1.1 200 OK\r\n"
-> "Date: Thu, 1 Feb 2018 23:39:52 GMT\r\n"
-> "Cache-Control: no-cache\r\n"
-> "Connection: Keep-Alive\r\n"
-> "Content-Type: text/xml; charset=utf-8\r\n"
-> "X-Frame-Options: DENY\r\n"
-> "Content-Length: 539\r\n"
-> "\r\n"
reading 539 bytes...
smlsml commented 6 years ago

I added a line to our app to output the value of $DEBUG

When bundled with ruby_parser 3.9.0, the value of $DEBUG is false When bundled with ruby_parser 3.10.1, the value of $DEBUG is true

This is with no other changes... I'm comparing the diff between the versions on github, don't see anything obvious, hum.

zenspider commented 6 years ago

Can you tell me if you had a version bump in sexp_processor or any other deps?

zenspider commented 6 years ago

BTW... just for your hunt: ruby -d will also cause this...

zenspider commented 6 years ago

I did add this code:

+$DEBUG = true if ENV["DEBUG"]

so check env | grep DEBUG

smlsml commented 6 years ago

Hey Ryan,

Thanks for the replies. Yeah I noticed that it is something to do with $DEBUG getting set. I don’t know if this line is the culprit. I did look at the diff between .9 and .10 and didn’t see anything obvious.

I checked ENV too, no DEBUG is set before I start the app. I’ll do some checking to see if I can find when $DEBUG becomes true.

No other gems are changing at this point. I did: gem “ruby_parser”#, “~> 3.9” bundle update ruby_parser # 3.10.1 installs rake app:run

get debug output

gem “ruby_parser”, “3.9” bundle update ruby_parser # back to 3.9.0 rake app:run # our script

no more output

On Fri, Feb 2, 2018 at 1:34 PM Ryan Davis notifications@github.com wrote:

I did add this code:

+$DEBUG = true if ENV["DEBUG"]

so check env | grep DEBUG

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/seattlerb/ruby_parser/issues/258#issuecomment-362714319, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVwZGnAZLtffI2OCTvSZ_Matii0vtJ2ks5tQ39tgaJpZM4R2d16 .

zenspider commented 6 years ago

so to be clear... 3.10.0 doesn't have the problem for you. It is 3.10.1 that uses ENV["DEBUG"]. Something, somewhere has to be setting this variable in your env, or something is running with ruby -d (which also sets the variable).

For now, I'd stick to 3.10.0 as it has some nice extensions and fixes in it.

smlsml commented 6 years ago

Now that I know it is just $DEBUG, I can work-around this. But just for curiosity sake, I'll keep looking :)

Check this out.

ruby_parser 3.10.0:

before boot.rb: ENV DEBUG is "" AND DEBUG constant is "false"
before boot.rb: $DEBUG is "false"
after require rails/all: ENV DEBUG is "" AND DEBUG constant is "false"
after require rails/all: $DEBUG is "false"
I, [2018-02-03T06:47:02.181387 #54514]  INFO -- Xcessman::Xcess::BundleExec: Pinging http://127.0.0.1:3001/cv_api/version 
I, [2018-02-03T06:47:02.182148 #54514]  INFO -- Xcessman::Xcess::BundleExec: Server not yet accepting connections...
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251 - cannot load such file -- 2.3.5/ruby_prof.so
Exception `LoadError' at /Users/slawson/.rvm/gems/ruby-2.3.5@manager-ruby23/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:240 - cannot load such file -- 2.3.5/ruby_prof.so
after bundler: ENV DEBUG is "" AND constant is "false"
after bundler: $DEBUG is "true"
Exception `Errno::ENOENT' at /Users/slawson/code/manager/manager/config/application.rb:40 - No such file or directory @ rb_sysopen - config/svmanager.yml
end application.rb: ENV DEBUG is "" AND DEBUG constant is "false"
end application.rb: $DEBUG is "true"

ruby_parser 3.10.1

before boot: ENV DEBUG is "" AND constant is "false"
before boot: $DEBUG is "false"
after rails: ENV DEBUG is "" AND constant is "false"
after rails: $DEBUG is "false"
I, [2018-02-03T06:48:08.923298 #54667]  INFO -- Xcessman::Xcess::BundleExec: Pinging http://127.0.0.1:3001/cv_api/version 
I, [2018-02-03T06:48:08.923964 #54667]  INFO -- Xcessman::Xcess::BundleExec: Server not yet accepting connections...
after bundler: ENV DEBUG is "" AND constant is "false"
after bundler: $DEBUG is "false"
end app.rb: ENV DEBUG is "" AND constant is "false"
end app.rb: $DEBUG is "false"
* Listening on tcp://127.0.0.1:3001
Use Ctrl-C to stop
zenspider commented 6 years ago

Did you annotate that correctly? Your original bug is about "Forced $DEBUG output after 3.10.0 to 3.10.1 upgrade" but now you're saying that $DEBUG isn't set in 3.10.1?

Can you send over your Gemfile so I might replicate your environment?

smlsml commented 6 years ago

I meant to clarify that it isn’t just 3.9 to 3.10.1, but the 3.10.0 to 3.10.1 that appears to contain the addition.

I found some of our code that is doing ENV[‘DEBUG’] = ‘’ in an attempt to clear the value. Empty string being true in ruby, totally our issue. Thanks for entertaining me. Will close this when I get in front of a real device. Just caught me/us by surprise.

Thanks for your time.

On Feb 3, 2018, at 5:13 PM, Ryan Davis notifications@github.com wrote: Did you annotate that correctly? Your original bug is about "Forced $DEBUG output after 3.10.0 to 3.10.1 upgrade" but now you're saying that $DEBUG isn't set in 3.10.1?

Can you send over your Gemfile so I might replicate your environment?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

zenspider commented 6 years ago

You definitely want ENV.delete "DEBUG" or, from the outside, unset DEBUG