Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

badarg to pgsql_binary:encode/3 #459

Closed
kaos opened this Issue Nov 14, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Owner

kaos commented Nov 14, 2012

500 error

{{{badarg,[{pgsql_binary,encode,3,
                         [{file,"src/dbdrivers/postgresql/epgsql/pgsql_binary.erl"},
                          {line,25}]},
           {pgsql_connection,encode_parameter,2,
                             [{file,"src/dbdrivers/postgresql/epgsql/pgsql_connection.erl"},
                              {line,647}]},
           {pgsql_connection,encode_parameters,5,
                             [{file,"src/dbdrivers/postgresql/epgsql/pgsql_connection.erl"},
                              {line,639}]},
           {pgsql_connection,ready,3,
                             [{file,"src/dbdrivers/postgresql/epgsql/pgsql_connection.erl"},
                              {line,277}]},
           {gen_fsm,handle_msg,7,[{file,"gen_fsm.erl"},{line,494}]},
           {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]},
  {gen_fsm,sync_send_event,
           [<0.17195.1>,
            {equery,{statement,[],[{column,<<"count">>,int8,8,-1,1}],[int8]},
                    [{int8,false}]},
            600000]}},
 [{gen_fsm,sync_send_event,3,[{file,"gen_fsm.erl"},{line,214}]},
  {pgsql,equery,4,
         [{file,"src/dbdrivers/postgresql/epgsql/pgsql.erl"},{line,165}]},
  {pgsql,equery1,4,
         [{file,"src/dbdrivers/postgresql/epgsql/pgsql.erl"},{line,129}]},
  {z_db,'-q1/4-fun-0-',4,
        [{file,"src/dbdrivers/postgresql/z_db.erl"},{line,294}]},
  {z_db,with_connection,3,
        [{file,"src/dbdrivers/postgresql/z_db.erl"},{line,195}]},
  {m_rsc_gone,'-is_gone/2-fun-0-',2,
              [{file,"src/models/m_rsc_gone.erl"},{line,68}]},
  {z_depcache,memo,5,[{file,"src/support/z_depcache.erl"},{line,91}]},
  {controller_page,previously_existed,2,
                   [{file,"modules/mod_base/controllers/controller_page.erl"},
                    {line,51}]}]}

Judging by the m_rsc_gone in the backtrace, this might be related to the recent addition in #450.
/me is investigating...

@ghost ghost assigned kaos Nov 14, 2012

Owner

mworrell commented Nov 14, 2012

Looks like the function is called with something else than an integer.

I think we need a guard is_integer(...) on the argument and check the name field when it is not.
Which makes me think that #450 should also check somewhere in the rewriter that maps a page_path to a resource id.

Owner

kaos commented Nov 14, 2012

Yeah, I think it got a 'false', due to the fact that the resource doesn't exist (have a name that it needs to look up in the dispatch file) (from controller_page:get_id/1).

@kaos kaos closed this in ae823f4 Nov 14, 2012

rpip pushed a commit to rpip/zotonic that referenced this issue Aug 12, 2013

core: add guards to m_rsc_gone functions.
This gives a better error message.

Fix for controller_page:previously_existed/2 to return 404 for unknown resource id's.

Fixes #459.

Also an additional fix for controller_page:resource_exists/2,
as discussed in commit 45bca64 on github.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment