Function clause error in cowboy_simple_bridge_anchor.erl

77 views
Skip to first unread message

Ramkrishna Kulkarni

unread,
Aug 11, 2015, 1:46:18 AM8/11/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hello,

After refreshing a page several times, I click on a button and start seeing these errors in the console continuously. Almost one every second.

Instead of refresh, if I redirect to this page (wf:redirect/1) this error goes away.

Could you please help me understand what this is?

Thanks.

...
          <<>>],
         [{file,"src/cow_qs.erl"},{line,34}]},
 {sbw,cache_post_params,1,[{file,"src/sbw.erl"},{line,138}]},
 {simple_bridge,inner_make,2,[{file,"src/simple_bridge.erl"},{line,86}]},
 {cowboy_simple_bridge_anchor,handle,2,
                              [{file,"src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
                               {line,33}]},
 {cowboy_handler,handler_handle,4,
                 [{file,"src/cowboy_handler.erl"},{line,111}]},
 {cowboy_protocol,execute,4,[{file,"src/cowboy_protocol.erl"},{line,442}]}]
=ERROR REPORT==== 11-Aug-2015::11:11:50 ===
Error in process <0.10105.0> on node 'my...@127.0.0.1' with exit value: {[{reason,function_clause},{mfa,{cowboy_simple_bridge_anchor,handle,2}},{stacktrace,[{cowboy_simple_bridge_anchor,handle,2,[{file,"src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},{line,33}]},{cowboy_handler...

Ramkrishna Kulkarni

unread,
Aug 11, 2015, 5:08:15 AM8/11/15
to nitro...@googlegroups.com
Hello,


Error status with parsing query params.

Error in simple_bridge:make/2 - error - function_clause
[{cow_qs,parse_qs_name,
         [<<"=&args=g2wAAA ...

Thanks.

--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb...@googlegroups.com.
To post to this group, send email to nitro...@googlegroups.com.
Visit this group at http://groups.google.com/group/nitrogenweb.
For more options, visit https://groups.google.com/d/optout.

Jesse Gumm

unread,
Aug 11, 2015, 7:34:08 AM8/11/15
to nitrogenweb

Interesting. Based on the error, I'd guess cow_qs is choking on the empty key-value in the submitted post string (=&).

Weird that that's being submitted at all like that and that using wf:redirect solves it. I'll have to see if I can reproduce.

Ramkrishna Kulkarni

unread,
Dec 8, 2015, 2:24:10 AM12/8/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

Do you have any more inputs on this issue? I'm facing this issue quite often now. You can see the full error log here https://gist.github.com/rkulkarni/85c0adb982ce5b469d14.

Thanks.

Ramkrishna Kulkarni

unread,
Dec 8, 2015, 2:44:46 AM12/8/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Another strange thing I've noticed is that client keeps on making AJAX request when this error occurs.

Request Method:POST
Status Code:500 Internal Server Error
Remote Address:x.x.x.x:443


Ram

Ramkrishna Kulkarni

unread,
Dec 8, 2015, 2:52:22 AM12/8/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

Could this be due to failed websocket connection establishment? I've seen this error in browser console few times when this happens.

WebSocket connection to 'wss://x/oetest?mode=search' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

Also, wondering if there is a way to disable websockets. 

Thanks for the help.

Ram

Jesse Gumm

unread,
Dec 8, 2015, 4:31:31 PM12/8/15
to nitrogenweb
Hey Ram,

Thanks for the gists.

I'm looking into this deeper right now. It's definitely cow_qs choking
on the "&= produced by line 33 of the "POST" gist.

Do you have a textbox (or other form element) on the page that isn't a
Nitrogen element?

I'm spitballing here, but I was able to at least reproduce it myself,
and fixed it with this commit. Give this a shot and let me know. If
it works for you, I'll merge it into mainline as is:
https://github.com/choptastic/nitrogen_core/commit/0a43407c3dc4fd9fcf025d79978d64a0813c5c55


On Tue, Dec 8, 2015 at 1:52 AM, Ramkrishna Kulkarni
--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Jesse Gumm

unread,
Dec 8, 2015, 4:36:47 PM12/8/15
to nitrogenweb
Oh, and as for disabling websockets, this particular error only seemed
to occur on fallback to using POSTs rather than websockets, hence why
you might think it was indeed related to websockets.

BUT, you can indeed disable websockets. In your template, stick the
following code snippet near the top (preferably before loading
nitrogen.js), and WebSockets will be unavailable in your app.

<script>WebSocket = undefined;</script>

-Jesse

Ramkrishna Kulkarni

unread,
Dec 9, 2015, 1:25:30 AM12/9/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Thanks a lot for the fix! That did fix the problem. Also, this problem is always reproducible for me when I disable websockets.

I don't think there are any non-nitrogen elements but now I'll take a deeper look as your fix worked.

Thanks again!

Ramkrishna Kulkarni

unread,
Dec 10, 2015, 1:31:36 AM12/10/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Hi Jesse,

I did find couple of non-nitrogen elements on the page. But it's strange it worked most of the times but broke some times. However, it broke always with websockets disabled.

Ram

Jesse Gumm

unread,
Dec 10, 2015, 2:30:29 PM12/10/15
to nitrogenweb
Yeah, very strange that it worked most of the time.

Without seeing the code, I don't have an explanation why it was
intermittent, but at the very least, it's fixed and merged into
master.

Thanks for your patience!

On Thu, Dec 10, 2015 at 12:31 AM, Ramkrishna Kulkarni
Reply all
Reply to author
Forward
0 new messages