Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Never close $stdout #214

Merged
merged 2 commits into from
Aug 27, 2014
Merged

Never close $stdout #214

merged 2 commits into from
Aug 27, 2014

Conversation

quixoten
Copy link
Contributor

This change was causing issues in practice.


RFC @abrandoned

@localshred
Copy link
Contributor

👍

There's not a great way to handle automatically closing old file
descriptors, so I'm just going to leave it out for now.
@quixoten
Copy link
Contributor Author

@localshred, I just removed the "close old logger" code all together. There's not a straightforward way to handle this, so we'll leave it up to the user to close old loggers if they're changing them using initialize_logger which should be rare.

My previous attempt was checking the new loggers target, rather than the old one, so it would still happily close $stdout if the new logger was using a file for a target if the previous one used $stdout.

@quixoten
Copy link
Contributor Author

As far as I can tell, the Logger class doesn't make its target easily accessible.

@localshred
Copy link
Contributor

I wouldn't ever close $stdout, since that's global to the process.

@quixoten
Copy link
Contributor Author

@localshred, agreed. The issue I'm running into is that I can't get to the old logger's target to make sure it's not $stdout before closing it.

@mmmries
Copy link
Member

mmmries commented Aug 27, 2014

Just ran into this, couldn't run rake db:migrate because puts would fail. Glad you guys are already on it. 👍

liveh2o added a commit that referenced this pull request Aug 27, 2014
@liveh2o liveh2o merged commit 3a32c1c into ruby-protobuf:master Aug 27, 2014
@liveh2o
Copy link
Contributor

liveh2o commented Aug 27, 2014

That might be a misattribution, @hqmq. I think you meant Scumbag @quixoten :-)

@mmmries
Copy link
Member

mmmries commented Aug 27, 2014

@abrandoned sorry, I thought it was your PR that introduced the bug, generating new meme... stand by

@localshred
Copy link
Contributor

This image makes me infinitely happy. I think we have a new meme on our hands. 👍 💯 🏆 🎆

@mmmries
Copy link
Member

mmmries commented Aug 27, 2014

scumbag devin

@liveh2o
Copy link
Contributor

liveh2o commented Aug 27, 2014

Hahahah

@mmmries
Copy link
Member

mmmries commented Aug 27, 2014

Looks like there is still an issue with this set of changes:

NameError: uninitialized constant Logger
  const_missing at /srv/amigo/shared/bundle/jruby/1.9/gems/protobuf-3.3.1/lib/protobuf/cli.rb:26
            CLI at /srv/amigo/shared/bundle/jruby/1.9/gems/protobuf-3.3.1/lib/protobuf/cli.rb:26
       Protobuf at /srv/amigo/shared/bundle/jruby/1.9/gems/protobuf-3.3.1/lib/protobuf/cli.rb:8
         (root) at /srv/amigo/shared/bundle/jruby/1.9/gems/protobuf-3.3.1/lib/protobuf/cli.rb:7
        require at /srv/amigo/shared/bundle/jruby/1.9/gems/protobuf-3.3.1/bin/rpc_server:1
         (root) at /srv/amigo/shared/bundle/jruby/1.9/gems/protobuf-3.3.1/bin/rpc_server:1
           load at /srv/amigo/shared/bundle/jruby/1.9/bin/rpc_server:23
         (root) at /srv/amigo/shared/bundle/jruby/1.9/bin/rpc_server:23

I think you need to require 'logger' from the standard library in order to use the Logger::INFO constant.

@liveh2o
Copy link
Contributor

liveh2o commented Aug 27, 2014

Fail.

@liveh2o
Copy link
Contributor

liveh2o commented Aug 27, 2014

Is that the only issue, @hqmq? If so, we can patch this quickly. Otherwise, we should probably take a quick pass through and double check things.

@mmmries
Copy link
Member

mmmries commented Aug 27, 2014

@liveh2o that was as far as I got trying to deploy with it, I rolled back to 3.2.1 for now in amigo. I think we should probably take a close look before releasing another patch version (ie. actually try running the code on a real server)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants