[phusion-passenger] NoMethodError (private method `getc' called for #<PhusionPassenger::Utils::RewindableInput:0x104131988>):

125 views
Skip to first unread message

drchiu

unread,
Apr 17, 2010, 11:19:50 PM4/17/10
to Phusion Passenger Discussions
Getting this error: NoMethodError (private method `getc' called for
#<PhusionPassenger::Utils::RewindableInput:0x104131988>):

Scenario:
- Setting up two rails application on two separate VirtualHost domain
(eg. app1.local, app2.local)
- Making an ActiveResource call from one app to the second app

Error Trace:

-- Begin --
Started POST "/stores.xml" for 127.0.0.1 at 2010-04-17 23:18:39
Error occurred while parsing request parameters.
Contents:

<?xml version="1.0" encoding="UTF-8"?>
<store>
<name>some name</name>
</store>

NoMethodError (private method `getc' called for
#<PhusionPassenger::Utils::RewindableInput:0x1044e22d0>):
-- End --

Any ideas?

--
You received this message because you are subscribed to the Google Groups "Phusion Passenger Discussions" group.
To post to this group, send email to phusion-...@googlegroups.com.
To unsubscribe from this group, send email to phusion-passen...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/phusion-passenger?hl=en.

Hongli Lai

unread,
Apr 18, 2010, 4:31:18 AM4/18/10
to phusion-...@googlegroups.com
On Sun, Apr 18, 2010 at 5:19 AM, drchiu <skh...@gmail.com> wrote:
> Getting this error: NoMethodError (private method `getc' called for
> #<PhusionPassenger::Utils::RewindableInput:0x104131988>):
>
> Scenario:
> - Setting up two rails application on two separate VirtualHost domain
> (eg. app1.local, app2.local)
> - Making an ActiveResource call from one app to the second app
>
> Error Trace:
>
> -- Begin --
> Started POST "/stores.xml" for 127.0.0.1 at 2010-04-17 23:18:39
> Error occurred while parsing request parameters.
> Contents:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <store>
>  <name>some name</name>
> </store>
>
> NoMethodError (private method `getc' called for
> #<PhusionPassenger::Utils::RewindableInput:0x1044e22d0>):
> -- End --
>
> Any ideas?

This is a bug in either your application or in ActiveResource.
According to the Rack specification, rack.input does not have to
respond to #getc: http://rack.rubyforge.org/doc/SPEC.html

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

drchiu

unread,
Apr 18, 2010, 9:36:43 AM4/18/10
to Phusion Passenger Discussions
You're right. I'm inclined to think this is a bug in Rails 3 beta 3
ActionController.

Calling from Rails 2.3.5 ActiveResource => Rails 3.0.0 beta 3
ActionController will cause this error, but in reverse with a Rails 3
ActiveResource => Rails 2.3.5 ActionController seems okay.

This error seems to be caused whenever XML is being sent. Will try and
track this down. Darn trace and log doesn't tell me much.

Thanks anyway Hongli.


On Apr 18, 4:31 am, Hongli Lai <hon...@phusion.nl> wrote:

>
> This is a bug in either your application or in ActiveResource.
> According to the Rack specification, rack.input does not have to
> respond to #getc:http://rack.rubyforge.org/doc/SPEC.html
>

--

drchiu

unread,
Apr 19, 2010, 12:20:56 AM4/19/10
to Phusion Passenger Discussions
If others encounter this problem, for your reference:
https://rails.lighthouseapp.com/projects/8994/tickets/4437-xml-mini-parser-nomethoderror-getc-when-application-running-through-phusion-passenger#ticket-4437-1

On Apr 18, 9:36 am, drchiu <skhc...@gmail.com> wrote:
> You're right. I'm inclined to think this is a bug in Rails 3 beta 3
> ActionController.
>
> Calling from Rails 2.3.5 ActiveResource => Rails 3.0.0 beta 3
> ActionController will cause this error, but in reverse with a Rails 3
> ActiveResource => Rails 2.3.5 ActionController seems okay.
>
> This error seems to be caused whenever XML is being sent. Will try and
> track this down. Darn trace and log doesn't tell me much.
>
> Thanks anyway Hongli.
>

anywho

unread,
May 20, 2010, 12:02:25 PM5/20/10
to Phusion Passenger Discussions
I'm getting the same error. However, I do not see this error using
webrick, and in testing using rack. I only have this issue with
passenger which lead me to believe it is a passenger issue.
However, as the ticket has been resolved maybe not. Just thought I'd
point this out for others.


On Apr 18, 9:20 pm, drchiu <skhc...@gmail.com> wrote:
> If others encounter this problem, for your reference:https://rails.lighthouseapp.com/projects/8994/tickets/4437-xml-mini-p...
>
> On Apr 18, 9:36 am, drchiu <skhc...@gmail.com> wrote:
>
> > You're right. I'm inclined to think this is a bug in Rails 3 beta 3
> > ActionController.
>
> > Calling from Rails 2.3.5 ActiveResource => Rails 3.0.0 beta 3
> > ActionController will cause thiserror, but in reverse with a Rails 3
> > ActiveResource => Rails 2.3.5 ActionController seems okay.
>
> > Thiserrorseems to be caused whenever XML is being sent. Will try and

Hongli Lai

unread,
May 20, 2010, 1:25:02 PM5/20/10
to phusion-...@googlegroups.com
On Thu, May 20, 2010 at 6:02 PM, anywho <eyda...@gmail.com> wrote:
> I'm getting the same error. However, I do not see this error using
> webrick, and in testing using rack. I only have this issue with
> passenger which lead me to believe it is a passenger issue.
> However, as the ticket has been resolved maybe not. Just thought I'd
> point this out for others.

That is because Webrick exposes a StringIO as the rack.input, and
StringIO responds to #getc. But according to the Rack spec rack.input
doesn't not *have* to respond to #getc. Rails is violating the Rack
spec by assuming that #getc is available everywhere.

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

anywho

unread,
May 21, 2010, 12:50:09 AM5/21/10
to Phusion Passenger Discussions
Nice explanation, thank you very much

On May 20, 10:25 am, Hongli Lai <hon...@phusion.nl> wrote:
> On Thu, May 20, 2010 at 6:02 PM, anywho <eydai...@gmail.com> wrote:
> > I'm getting the same error. However, I do not see this error using
> > webrick, and in testing using rack. I only have this issue with
> > passenger which lead me to believe it is a passenger issue.
> > However, as the ticket has been resolved maybe not. Just thought I'd
> > point this out for others.
>
> That is because Webrick exposes a StringIO as the rack.input, and
> StringIO responds to #getc. But according to the Rack spec rack.input
> doesn't not *have* to respond to #getc. Rails is violating the Rack
> spec by assuming that #getc is available everywhere.
>
> --
> Phusion | The Computer Science Company
>
> Web:http://www.phusion.nl/
> E-mail: i...@phusion.nl
Reply all
Reply to author
Forward
0 new messages