Page 1 of 1
[12:34:02] mfoo: Unicorn's documentation for HUP handling states that it "gracefully restarts all workers" - it seems to actually pause requests, then restart all workers at the same time. The effect is that requests hang (connections don't drop). Is there a minimum pool size such that there are always some available workers?
[12:36:50] mfoo: (note that Puma's documentation for USR1 specifies "restart workers in phases, a rolling restart" a number which I assume can be configured but can't find the config for yet
[15:34:21] mfoo: Hi. I have a layout docs.html.haml which renders a head template containing a yield for stylesheets and a yield block for views. The controller calls render :index, layout: 'docs'. In development this works fine. After asset precompilation, none of the content_for blocks from the index view are rendered. Am I missing something?
[15:35:40] mfoo: *the head template has the yield for styleshsets. The layout has the yield for views
[15:41:42] mfoo: this will iterate. doesn't .where(id: id) work? This will move the work into the database.
[13:32:50] mfoo: Hello - I'm looking to implement structured logging for aggregation in the ELK stack. I've used LogRage with the Logstash formatter, but this doesn't change non-request logs (exceptions, asset serving etc seem to use the rack logger). I've tried the logstasher gem but this prints each line of a backtrace as a separate JSON message. Is there anybody with experience of this or a guide that's around?
[13:33:33] mfoo: Ideally I'd like multiple appenders (human readable to a file, json to a file/socket)
[13:38:51] mfoo: matthewd: But the effect is the same - I believe the problem is the "logstasher" logger in this case
[13:39:33] mfoo: Mostly I'm looking for a guide on "how to do logging the right way" or similar - logs for machine consumption.
[13:40:13] mfoo: I can see many posts focussing on request logging, which is fine, but I would like to log stack traces in a structured way also
[15:06:06] mfoo: Can I ask why (in activesupport 22.214.171.124) ActiveSupport::Notifications::Instrumenter#instrument doesn't include the stack trace, only the class and the message?
[15:10:00] mfoo: workmad3: I'm trying to implement some structured logs, in this case using a JSON log formatter. The payload passed to the formatter contains the exception class name and message as an array, but this gets put there by ActiveSupport::Notifications::Instrumenter#instrument (if an uncaught exception bubbles into action controller). This means my logger doesn't have access to the stacktrace.
[15:13:45] mfoo: matthewd: I ofcourse appreciate that people don't anticipate all possible use cases. I was mostly trying to ask "am I doing this wrong, or is this an oversight"
[10:11:13] mfoo: is there a message length limit here? I believe I just asked a fairly long question but don't see it
[10:17:54] mfoo: Hi all - I'm having an issue with rolling restarts on unicorn. The master successfully cycles the children after a SIGUP, yet occasionally they get stuck in a respawn loop due to a crash in initialisation.
[10:17:58] mfoo: This is from a call (in this case in a model, I'm unsure if are other triggers) to a function provided by a gem that didn't exist before the upgrade.
[10:18:04] mfoo: The gems have definitely been installed at this point and restarting the unicorn service brings it back up fine.
[10:18:11] mfoo: As I understand it the default option for unicorn is to set "preload_app" to false which disables shared memory allocation and forces rails to be reloaded when the unicorn worker comes up. We haven't changed this option.
[17:07:54] mfoo: Hi guys, I need some help. I'm setting up rails deployment with capistrano. After precompilation rails is serving me a 204 No Content for my application.css and a file containing two newline characters for JS, yet I can see the file on disk with the same name as the asset being sent back to me has the expected content. I've tried clearing my browser cache and I'm not sure what's going on.
[09:53:35] mfoo: Hello. Is a record obtained through activerecord pessimistic locking outside of a transaction ever released unless done manually? I don't see any locks in InnoDB in this case. Does the activerecord object have a finalizer on it that releases the lock?
[14:32:24] mfoo: Is anybody using rolling restarts with unicorn? What criteria do you use to determine if the master is ready before sending QUIT to the old master? Checking that the new rails instances are listening on a port doesn't tell me if any of the old ones are still handling requests
[15:50:18] mfoo: Hi, I've got an application.css inside an empty app/assets/stylesheets.css in a rails 5 app. It contains "/*\n *= require_tree .\n *=require_self\n */". My app has started failing with "couldn't digest ActiveSupport::StringInquirer". If I delete the require_tree it does not fail. I have no styles in the directory. What could be broken?
[16:34:21] mfoo: hello - could I enquire as to how exception handling happens in ruby? I am used to begin/rescue but I see code here rescueing from a NameError outside a begin block. Why is line 456 evaluated in Ruby? https://github.com/rails-api/active_model_serializers/blob/0-8-stable/lib/active_model/serializer.rb#L454
[16:37:06] mfoo: and define a method for that class so we don't have to iterate for every object of that class
[14:19:48] mfoo: It looks like I have a JBuilder template that's throwing an exception in a certain case. In the rails log I just get told that it couldn't find the template. I know it can because it works under other circumstances. How do I get to the underlying error? Rendering the views manually is a bit of a PITA from the rails console.
[14:30:52] mfoo: it's an old API, and unfortunately no I can't. I appreciate this is makes helping difficult. My question was how I see an underlying 'view cannot be found' exception (and why that happens rather than the actual exception bubbling up), rather than 'can you find what is causing my exception' :)
[10:42:26] mfoo: Does anybody have experience with rolling out a new API version? I have some questions that I posted on SO yesterday but haven't had an answer to yet
[10:48:09] mfoo: just in case anybody does have experience and would like to answer, http://stackoverflow.com/questions/30852006/the-correct-way-to-version-rails-3-apis
[12:49:01] mfoo: ddv: what about running specs on the new api? do I copy the v1 specs and make a tiny change? what about code duplication?
[12:49:56] mfoo: we must clean our desks due to a security policy (at least, keep them clear, not wash them)
[08:56:40] mfoo: I've seen a lot of posts about containerising Rails using Docker. If people are spawning one rails instance per container, how does rails handle running migrations when they come up if you spawn multiple containers? Do people just spawn a single container with e.g. unicorn and run multiple rails workers inside it?
[16:50:15] mfoo: I'm trying to find some documentation on the recommended way to version APIs. Our Rails 3 application has a large number of controllers sitting under the Api::V1 namespace and objects using activemodel serializers. How do we introduce a breaking API change to a serializer for one REST route? Is it possible to introduce a version 2 without making a copy of all of the controllers and serializers used for version 1?
[16:52:28] mfoo: I'm also interested in the copying of the controller and serializer specs and how these should be versioned
[09:25:21] mfoo: Is there an equivalent to mysql client's "-A" flag that can be given to rake db:migrate? I have a database that takes 10 minutes to run db:migrate on just for rails to discover there are no migrations to perform
[09:26:29] mfoo: -A disables metadata when connecting over mysql client, so you e.g. don't get tab completion for table names or column names
[09:26:53] mfoo: my assumption is that db:migrate is doing something similar, because like you said, reading a single value from a table is fast
[09:27:21] mfoo: the same migration on the same schema version on all of my other databases (which are much smaller) takes almost no time
[09:28:24] mfoo: the database has a few thousand tables in it, which is why the -A is necessary for connecting with mysql client
[09:28:51] mfoo: please no "re-architect your database" comments, we have much higher performance this way.
[09:31:22] mfoo: the puppet scripts perform db:migrate in the rollout phase all the time, even when there are no table changes, because db:migrate handles whether or not it's necessary and I don't believe there's a better way of determining if the migration is necessary
[09:32:02] mfoo: as above, the same schema version with db:migrate performed on it is almost instant on other much smaller databases, so I'm assuming it's related to the number of tables in the database but I don't know why this would cause db:migrate to be slow
[09:32:17] mfoo: I therefore am assuming it's to do with gathering table metadata, which seems unnecessary
[09:33:33] mfoo: harly, I came here for suggestions because my assumption sounds weird. I'll have to enable the full query log and see what rails is doing I guess.
[09:35:16] mfoo: I am not asking about improvements to my situation, I'm asking what reason db:migrate might be slow on a fairly large database when there are no changes to be made
[09:38:09] mfoo: certainly it's strange, and certainly the tables could be moved to a different database, but I'm specifically asking what about having a lot of tables would make db:migrate slow when the schema version isn't changing. I.e. why would db:migrate need to care about those tables, surely it just checks a timestamp/schema version from the migrations table
[09:39:23] mfoo: harly, as above, in all of the other environments with fewer tables and on the same schema version, db:migrate takes a second or three
[09:54:56] mfoo: harly, so infact what should be happening (ignoring the fact that actual migrations will be slow due to dumping the schema, which is another problem) to fix slow migrations that perform no change is checking the output of db:migrate:status first?
[09:57:30] mfoo: harly, sure, I'll verify this in dev, but I'm 99% sure it is due to table count, I have no reason to believe the tables need to be scanned by rails during a migration.
[10:05:01] mfoo: harly, thanks. Combining this with a check of Rails.env looks like it would work. We never need to import a production schema in dev (we can use a mysql schema dump anyway if we had to)
[15:59:33] mfoo: Hello. I'm confused by the rails security guide. Assuming I am using a non-default (say activerecord) session store, my cookies have my session ID in them. Let's assume I logged in from a public computer and didn't clear my cookies. What prevents somebody from reading that session ID and transmitting that with requests? I understand that it's safe from tampering but how is it different from storing the session token in a base64 encoded cookie using the C
[14:16:51] mfoo: Hello. I'm reading the security guidelines. The session fixation suggestion is to call reset_session upon successful user login. http://guides.rubyonrails.org/security.html#session-fixation-countermeasures Am I correct in thinking that it's not possible for rails to expire sessions when using the CookieStore? (I.e. if somebody had a copy of the cookie containing a valid session ID, they could still impersonate a user after reset_session had been called)?
[11:17:58] mfoo: Hello. I have a rails engine mounted. My engine's ApplicationController inherits from the parent ApplicationController. When config.cache_classes is false in the parent a page from the engine works fine until the page is refreshed and then it fails. This seems to be because the parent code is unloaded before the second request and is not loaded back again.
[11:22:37] mfoo: in this case the parent application controller defines a bunch of non standard error handling as well as things like ensuring that devise authentication happens in each controller method
[11:41:59] mfoo: rushed, I fixed the issue bizarrely. Can somebody explain how the two lines in http://guides.rubyonrails.org/engines.html#using-a-controller-provided-by-the-application is different to http://pastebin.com/37xePag7 ? The rails guide code works properly and loads the parent application class as expected, while the engine in the paste shows an undefined constant ParentApplicationName after a refresh with config.cache_classes=false.
[17:34:00] mfoo: My engine requires some classes from the parent application (such as the User class for devise). How can I include these files? Is it done inside spec_helper.rb?
[13:47:19] mfoo: Hi, my database.yml specifies a pool size of 5. Does activerecord's connection pool perform periodic liveness checks on database connections? I see the reaper can close long running connections
[13:52:14] mfoo: my database restarted earlier and a while later somebody received a "database has gone away" error, which, had that connection been in the pool, it should have been recycled
[13:52:51] mfoo: It is a very low volume site. I see no information on configuring liveness check times