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

restbackend: HTTP 500 on 'database' endpoint without 'sortBy' #1674

Open
BernhardDenner opened this Issue Oct 29, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@BernhardDenner
Contributor

BernhardDenner commented Oct 29, 2017

If the 'database' endpoint of the restbackend is called without an 'sortBy' option, the restbackend returns with HTTP 500 'internal server error'.

see #1673

  • Elektra Version: master
  • Versions of other relevant software?

Further Log Files and Output

@markus2330

This comment has been minimized.

Show comment
Hide comment
@markus2330

markus2330 Oct 29, 2017

Contributor

@Namoshek Do you have any idea about this error?

Contributor

markus2330 commented Oct 29, 2017

@Namoshek Do you have any idea about this error?

@markus2330

This comment has been minimized.

Show comment
Hide comment
@markus2330

markus2330 Oct 29, 2017

Contributor

The full error is:


Running "copy:build" (copy) task
Copied 4 files

Running "create-website-sitemap:build" (create-website-sitemap) task
>> Could not reach Backend and could therefore not create sitemap.xml!
Warning: Server responded with status code 500:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>500 &mdash; Internal Server Error</title>
  </head>
  <body>
    <h1>500 &mdash; Internal Server Error</h1>
    <p>map::at
</p>
  </body>
</html>
� Use --force to continue.

Aborted due to warnings.

see https://build.libelektra.org/jenkins/job/elektra-homepage/218/console

Contributor

markus2330 commented Oct 29, 2017

The full error is:


Running "copy:build" (copy) task
Copied 4 files

Running "create-website-sitemap:build" (create-website-sitemap) task
>> Could not reach Backend and could therefore not create sitemap.xml!
Warning: Server responded with status code 500:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>500 &mdash; Internal Server Error</title>
  </head>
  <body>
    <h1>500 &mdash; Internal Server Error</h1>
    <p>map::at
</p>
  </body>
</html>
� Use --force to continue.

Aborted due to warnings.

see https://build.libelektra.org/jenkins/job/elektra-homepage/218/console

@Namoshek

This comment has been minimized.

Show comment
Hide comment
@Namoshek

Namoshek Oct 30, 2017

Contributor

My best guess is that it has something to do with a missing configuration parameter accessed here. Maybe the config-specification is not mounted properly? In the spec, a default for this parameter is defined. I remember we had some trouble with this default, but no idea what exactly that was though.

Contributor

Namoshek commented Oct 30, 2017

My best guess is that it has something to do with a missing configuration parameter accessed here. Maybe the config-specification is not mounted properly? In the spec, a default for this parameter is defined. I remember we had some trouble with this default, but no idea what exactly that was though.

@BernhardDenner

This comment has been minimized.

Show comment
Hide comment
@BernhardDenner

BernhardDenner Oct 30, 2017

Contributor

I've attached a gdb recently on it:

std::sort (entries.rbegin (), entries.rend (), SORT_ENTRY_MAP.at (sortby));

It seems that SORT_ENTRY_MAP.at ('key') throws an exception. However, this should be a "static" map, including the key ... hmm maybe I've too less cpp knowledge to understand that ;)

Contributor

BernhardDenner commented Oct 30, 2017

I've attached a gdb recently on it:

std::sort (entries.rbegin (), entries.rend (), SORT_ENTRY_MAP.at (sortby));

It seems that SORT_ENTRY_MAP.at ('key') throws an exception. However, this should be a "static" map, including the key ... hmm maybe I've too less cpp knowledge to understand that ;)

@markus2330

This comment has been minimized.

Show comment
Hide comment
@markus2330

markus2330 Oct 30, 2017

Contributor

Do you mean the string key, 'key' would be an compilation error ;) Or it is with quotes embedded in the string and thus wrongly spelled and cannot be found?

Because there is no write attempt to the map, I would expect it to be a typo. We should add validation code into the spec ;)

static

static is massively overloaded in C++. Within functions it means it should be global. But for global variables it means that they should not be a public symbol. We can move it into DatabaseApp::processSorting, static would have a different meaning there, but it would be correct (and the scope of the variable better limited).

Any reason the map is not const?

Contributor

markus2330 commented Oct 30, 2017

Do you mean the string key, 'key' would be an compilation error ;) Or it is with quotes embedded in the string and thus wrongly spelled and cannot be found?

Because there is no write attempt to the map, I would expect it to be a typo. We should add validation code into the spec ;)

static

static is massively overloaded in C++. Within functions it means it should be global. But for global variables it means that they should not be a public symbol. We can move it into DatabaseApp::processSorting, static would have a different meaning there, but it would be correct (and the scope of the variable better limited).

Any reason the map is not const?

BernhardDenner added a commit that referenced this issue Oct 30, 2017

rest-frontend: workaround backend bug #1674
We simply workaround Bug #1674 by directly specifying the 'sortby'
parameter when building the sitemap. However, this needs to be fixed in
the backend.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment