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.

On Wednesday, 21 August 2013 16:51:11 UTC-4, [email protected] wrote:

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 J.

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.

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

[email protected]