ianchoi-BIiLiSArgaXQT0dZR+AlfA@public.gmane.org
2013-Aug-21 20:51 UTC
syntax error, unexpected tRPAREN raised in server log
In my server log, I am seeing this error message that is raised in activesupport. 2013-08-12T23:06:08.932580+00:00 app[web.2]: SyntaxError (/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:374: syntax error, unexpected tRPAREN 2013-08-12T23:06:08.932580+00:00 app[web.2]: 2013-08-12T23:06:08.932580+00:00 app[web.2]: def () value = nil 2013-08-12T23:06:08.932580+00:00 app[web.2]: ^): 2013-08-12T23:06:08.932580+00:00 app[web.2]: app/controllers/api/users_controller.rb:42:in `show'' 2013-08-12T23:06:08.932580+00:00 app[web.2]: 2013-08-12T23:06:08.932580+00:00 app[web.2]: Any idea what would have caused it? The code I have looked like this: @user = User.with_clients.with_projects.find(doorkeeper_token.resource_owner_id) I cannot reproduce this but this error show up in the log occasionally. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fb299fa9-cecf-413e-b22d-279b32dbab2c%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Matt Jones
2013-Aug-23 12:27 UTC
Re: syntax error, unexpected tRPAREN raised in server log
On Wednesday, 21 August 2013 16:51:11 UTC-4, ian...-BIiLiSArgaXQT0dZR+AlfA@public.gmane.org wrote:> > In my server log, I am seeing this error message that is raised in > activesupport. > > 2013-08-12T23:06:08.932580+00:00 app[web.2]: SyntaxError > (/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:374: > syntax error, unexpected tRPAREN > 2013-08-12T23:06:08.932580+00:00 app[web.2]: > 2013-08-12T23:06:08.932580+00:00 app[web.2]: def () value = nil > 2013-08-12T23:06:08.932580+00:00 app[web.2]: ^): > 2013-08-12T23:06:08.932580+00:00 app[web.2]: > app/controllers/api/users_controller.rb:42:in `show'' > >"def () value = nil" is not valid syntax. Wherever that is in your code, you need to fix it... --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6068d11e-7aae-4d41-bb85-e6a995566a70%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
ianchoi-BIiLiSArgaXQT0dZR+AlfA@public.gmane.org
2013-Aug-23 19:20 UTC
Re: syntax error, unexpected tRPAREN raised in server log
This is my code, user controller 42: @user = User.with_clients.with_projects.find(doorkeeper_token.resource_owner_id) active support code that error out. def define_callbacks(kind, object) #:nodoc: name = _callback_runner_name(kind) unless object.respond_to?(name, true) str = object.send("#{kind}_callbacks").compile class_eval <<-RUBY_EVAL, __FILE, LINE + 1 def #{name}() #{str} end protected :#{name} RUBY_EVAL end name end So some how active support try to eval a "def () value = nil" here. Which mean #{name} is empty? I thought the code ... object.respond_to?(name, true) is intended to prevent cases where name is empty or nil. But when the #{name} used in the class_eval came from _callback_runner_name(kind) and has nothing to do with object.name So I am not sure if the code is checking the wrong thing when checking object.respond_to?(name, true) And I dont know at what instance would _callback_runner_name(kind) returns empty for me. Any idea what these code was intended to do. In the case that _callback_runner_name(kind) is returning empty, I am not sure how this will be my code causing the issue at the moment. [363, 372] in /Users/~/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/activesupport-4.0.0/lib/active_support/callbacks.rb 363 # This method defines callback chain method for the given kind 364 # if it was not yet defined. 365 # This generated method plays caching role. 366 def __define_callbacks(kind, object) #:nodoc: 367 debugger => 368 name = __callback_runner_name(kind) 369 unless object.respond_to?(name, true) 370 str = object.send("_#{kind}_callbacks").compile 371 class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 372 def #{name}() #{str} end /Users/~/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:368 name = __callback_runner_name(kind) (rdb:1) name = __callback_runner_name(kind) "_run__1313977386__find__callbacks" (rdb:1) kind :find (rdb:1) str nil (rdb:1) object.send("_#{kind}_callbacks").compile "value = nil\nhalted = false\nvalue = !halted && (!block_given? || yield)\nvalue" (rdb:1) object #<ClientMembership id: 1, client_id: 1, user_id: 1, is_client_admin: true, created_at: "2013-06-18 20:23:13", updated_at: "2013-06-18 20:23:13"> (rdb:1) object.name "dev-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org" On Friday, August 23, 2013 8:27:15 AM UTC-4, Matt Jones wrote:> > > > On Wednesday, 21 August 2013 16:51:11 UTC-4, ian...-BIiLiSArgaXQT0dZR+AlfA@public.gmane.org wrote: >> >> In my server log, I am seeing this error message that is raised in >> activesupport. >> >> 2013-08-12T23:06:08.932580+00:00 app[web.2]: SyntaxError >> (/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:374: >> syntax error, unexpected tRPAREN >> 2013-08-12T23:06:08.932580+00:00 app[web.2]: >> 2013-08-12T23:06:08.932580+00:00 app[web.2]: def () value = nil >> 2013-08-12T23:06:08.932580+00:00 app[web.2]: ^): >> 2013-08-12T23:06:08.932580+00:00 app[web.2]: >> app/controllers/api/users_controller.rb:42:in `show'' >> >> > "def () value = nil" is not valid syntax. Wherever that is in your code, > you need to fix it... > > --Matt Jones > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8e595aac-9732-498a-a6bc-37d785f52bc1%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
ianchoi-BIiLiSArgaXQT0dZR+AlfA@public.gmane.org
2013-Aug-28 18:53 UTC
Re: syntax error, unexpected tRPAREN raised in server log
The code in activesupport that is causing this is removed in Master branch. so I think the question is irrelevant now as the problem will no longer be an issue once it is released. On Friday, August 23, 2013 3:20:57 PM UTC-4, ian...-BIiLiSArgaXQT0dZR+AlfA@public.gmane.org wrote:> > This is my code, > > user controller 42: > @user = > User.with_clients.with_projects.find(doorkeeper_token.resource_owner_id) > > active support code that error out. > > def define_callbacks(kind, object) #:nodoc: > name = _callback_runner_name(kind) > unless object.respond_to?(name, true) > str = object.send("#{kind}_callbacks").compile > class_eval <<-RUBY_EVAL, __FILE, LINE + 1 > def #{name}() #{str} end > protected :#{name} > RUBY_EVAL > end > name > end > > So some how active support try to eval a "def () value = nil" here. Which > mean #{name} is empty? > > I thought the code ... > > object.respond_to?(name, true) is intended to prevent cases where name is > empty or nil. But when the #{name} used in the class_eval came from > _callback_runner_name(kind) and has nothing to do with object.name > > So I am not sure if the code is checking the wrong thing when checking > object.respond_to?(name, true) > > And I dont know at what instance would _callback_runner_name(kind) returns > empty for me. Any idea what these code was intended to do. In the case that > _callback_runner_name(kind) is returning empty, I am not sure how this > will be my code causing the issue at the moment. > > > [363, 372] in > /Users/~/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/activesupport-4.0.0/lib/active_support/callbacks.rb > > 363 # This method defines callback chain method for the given > kind > > 364 # if it was not yet defined. > > 365 # This generated method plays caching role. > > 366 def __define_callbacks(kind, object) #:nodoc: > > 367 debugger > > => 368 name = __callback_runner_name(kind) > > 369 unless object.respond_to?(name, true) > > 370 str = object.send("_#{kind}_callbacks").compile > > 371 class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 > > 372 def #{name}() #{str} end > > > /Users/~/.rbenv/versions/jruby-1.7.4/gemsets/ruby/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:368 > > name = __callback_runner_name(kind) > > (rdb:1) name = __callback_runner_name(kind) > > "_run__1313977386__find__callbacks" > > (rdb:1) kind > > :find > > (rdb:1) str > > nil > > (rdb:1) object.send("_#{kind}_callbacks").compile > > "value = nil\nhalted = false\nvalue = !halted && (!block_given? || > yield)\nvalue" > > (rdb:1) object > > #<ClientMembership id: 1, client_id: 1, user_id: 1, is_client_admin: true, > created_at: "2013-06-18 20:23:13", updated_at: "2013-06-18 20:23:13"> > > (rdb:1) object.name > > "dev-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org" > > > > On Friday, August 23, 2013 8:27:15 AM UTC-4, Matt Jones wrote: >> >> >> >> On Wednesday, 21 August 2013 16:51:11 UTC-4, ian...-BIiLiSArgaXQT0dZR+AlfA@public.gmane.org wrote: >>> >>> In my server log, I am seeing this error message that is raised in >>> activesupport. >>> >>> 2013-08-12T23:06:08.932580+00:00 app[web.2]: SyntaxError >>> (/app/vendor/bundle/jruby/1.9/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:374: >>> syntax error, unexpected tRPAREN >>> 2013-08-12T23:06:08.932580+00:00 app[web.2]: >>> 2013-08-12T23:06:08.932580+00:00 app[web.2]: def () value = nil >>> 2013-08-12T23:06:08.932580+00:00 app[web.2]: ^): >>> 2013-08-12T23:06:08.932580+00:00 app[web.2]: >>> app/controllers/api/users_controller.rb:42:in `show'' >>> >>> >> "def () value = nil" is not valid syntax. Wherever that is in your code, >> you need to fix it... >> >> --Matt Jones >> >> >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b4a0bd00-8e1b-45a8-8e7e-45ab1e7dc972%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.