Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON parser exception after refreshing token #13

Closed
TimKrause2 opened this issue Jun 25, 2015 · 2 comments
Closed

JSON parser exception after refreshing token #13

TimKrause2 opened this issue Jun 25, 2015 · 2 comments

Comments

@TimKrause2
Copy link

Here is the output of grive with --debug enabled

HTTP POST "https://www.googleapis.com/drive/v2/files" with "{"parents":[{"id":"0B4RChP-vlFkwYVdGZWZ2Z25GQ1k"}],"title":"duplicity-full.20150625T172107Z.vol34.difftar.gz"}"
HTTP response 200
HTTP PUT "https://www.googleapis.com/upload/drive/v2/files/0B4RChP-vlFkweVpTQ29DNGxYR3c?uploadType=media"
HTTP response 401
resquest failed due to auth token expired: 401. refreshing token
HTTP PUT "https://www.googleapis.com/upload/drive/v2/files/0B4RChP-vlFkweVpTQ29DNGxYR3c?uploadType=media"
exception: /home/tim/src/grive2-master/libgrive/src/json/JsonParser.cc(169): Throw in function void gr::JsonParser::Parse(const char_, std::size_t)
Dynamic exception type: boost::exception_detail::clone_implgr::JsonParser::Error
[gr::expt::BacktraceTag_] = #0 0x4f8f90 :0 gr::Exception::Exception()
#1 0x4efe35 :0 gr::JsonParser::Error::Error()
#2 0x4efac1 :0 gr::JsonParser::Parse(char const*, unsigned long)
#3 0x4ebc15 :0 gr::http::ValResponse::Write(char const*, unsigned long)
#4 0x4d94ae :0 gr::http::CurlAgent::Receive(void_, unsigned long, unsigned long, gr::DataStream_)
#5 0x7f841e922cd0 /usr/lib/x86_64-linux-gnu/libcurl.so.4
#6 0x7f841e937650 /usr/lib/x86_64-linux-gnu/libcurl.so.4
#7 0x7f841e9409dc /usr/lib/x86_64-linux-gnu/libcurl.so.4
#8 0x7f841e941181 /usr/lib/x86_64-linux-gnu/libcurl.so.4 curl_multi_perform
#9 0x7f841e9387b3 /usr/lib/x86_64-linux-gnu/libcurl.so.4 curl_easy_perform
#10 0x4d95f2 :0 gr::http::CurlAgent::ExecCurl(std::string const&, gr::DataStream*, gr::http::Header const&)
#11 0x4d9b8d :0 gr::http::CurlAgent::Put(std::string const&, gr::File_, gr::DataStream_, gr::http::Header const&)
#12 0x4e0712 :0 gr::AuthAgent::Put(std::string const&, gr::File_, gr::DataStream_, gr::http::Header const&)
#13 0x4d37fc :0 gr::v2::Syncer2::Upload(gr::Resource*)
#14 0x4d2dcc :0 gr::v2::Syncer2::Create(gr::Resource*)
#15 0x50088a :0 gr::Resource::SyncSelf(gr::Syncer*, gr::Val const&)
#16 0x500522 :0 gr::Resource::Sync(gr::Syncer*, gr::DateTime&, gr::Val const&)
#17 0x503ceb :0 boost::mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>::operator()(gr::Resource, gr::Syncer_, gr::DateTime&, gr::Val const&) const
#18 0x503407 :0 void boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val >::operator()<boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list1gr::Resource*& >(boost::_bi::type, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>&, boost::_bi::list1gr::Resource*&&, int)
#19 0x502b70 :0 void boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > >::operator()gr::Resource*(gr::Resource*&)
#20 0x50237b :0 boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > > std::for_each<__gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > > >(__gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, __gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::bi::valuegr::Val > >)
#21 0x500626 :0 gr::Resource::Sync(gr::Syncer*, gr::DateTime&, gr::Val const&)
#22 0x503ceb :0 boost::mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>::operator()(gr::Resource, gr::Syncer
, gr::DateTime&, gr::Val const&) const
#23 0x503407 :0 void boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val >::operator()<boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list1gr::Resource*& >(boost::_bi::type, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>&, boost::_bi::list1gr::Resource*&&, int)
#24 0x502b70 :0 void boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > >::operator()gr::Resource*(gr::Resource*&)
#25 0x50237b :0 boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > > std::for_each<__gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > > >(__gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, __gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::bi::valuegr::Val > >)
#26 0x500626 :0 gr::Resource::Sync(gr::Syncer*, gr::DateTime&, gr::Val const&)
#27 0x503ceb :0 boost::mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>::operator()(gr::Resource, gr::Syncer
, gr::DateTime&, gr::Val const&) const
#28 0x503407 :0 void boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val >::operator()<boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list1gr::Resource*& >(boost::_bi::type, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>&, boost::_bi::list1gr::Resource*&&, int)
#29 0x502b70 :0 void boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > >::operator()gr::Resource*(gr::Resource*&)
#30 0x50237b :0 boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > > std::for_each<__gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > > >(__gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, __gnu_cxx::__normal_iterator<gr::Resource**, std::vector<gr::Resource*, std::allocatorgr::Resource* > >, boost::_bi::bind_t<void, boost::_mfi::mf3<void, gr::Resource, gr::Syncer*, gr::DateTime&, gr::Val const&>, boost::_bi::list4boost::arg<1, boost::_bi::valuegr::Syncer*, boost::reference_wrappergr::DateTime, boost::_bi::valuegr::Val > >)
#31 0x500626 :0 gr::Resource::Sync(gr::Syncer*, gr::DateTime&, gr::Val const&)
#32 0x4c71a1 :0 gr::State::Sync(gr::Syncer*, gr::Val const&)
#33 0x4cbffa :0 gr::Drive::Update()
#34 0x4a8003 :0 Main(int, char**)
#35 0x4a8589 :0 main
#36 0x7f841d265ec5 /lib/x86_64-linux-gnu/libc.so.6 __libc_start_main
#37 0x4a6d89 :0 _start

[gr::JsonText*] = {
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}

[gr::ParseErr*] = parse error: trailing garbage
{ "error": { "errors": [
(right here) ------^

@TimKrause2
Copy link
Author

AuthAgent::Put is using the same http::ValResponse twice.

@vitalif
Copy link
Owner

vitalif commented Jun 27, 2015

Try out the latest master, I've just added some diagnostic information that will help resolve various bugs related to error response handling... And it should fix this issue as the side-effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants