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

Redmine plugin does not update issue #558

Closed
cesmarvin opened this issue Apr 9, 2014 · 53 comments
Closed

Redmine plugin does not update issue #558

cesmarvin opened this issue Apr 9, 2014 · 53 comments
Labels
bug Something isn't working

Comments

@cesmarvin
Copy link
Contributor

Original report by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


I'm familiar to SCM Manager but new to redmine plugin. I installed SCM-Manager and Redmine in to a Linux Virtual Machine and they are working well over SSL (With the help of Oracle JRE). I wanted to integrate SCM-Manager with redmine via redmine plugin but it does not work as I expect. Gives a lengthy HTML based "Server Error 500" (the whole error is attached) which was taken with "hg push --verbose --debug" command. The changesets are pushed successfuly but the scm server is havig issues with updating the redmine issue. (Just enabled issue update).

I'm using mercurial on a windows host machine and the certificates of both SCM-Manager and Redmine are self signed. Although I think I successfuly added the certificates in also the linux machine as trusted certificates.

Also resmine is accessible from inside (where SCM server is also running)

What could be wrong?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Also, this push does not create any "traces" in the log. It has been already set for TRACE.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


This looks like a version conflict of a library which is shipped with the plugin, but is also available in the core. Which version of SCM-Manager do you use?

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Possible fix: 5f349f6e

Could you please test the version below:

Note: You have to reinstall the plugin.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


The error is gone with any traces about the redmine plugin. No prompt for redmine update, no updates for the issue, no traces in the log. (By the way the insalled version was 1.36)

Username and password are the same for redmine and scm-manager.

Also, what should be the URL parameter for the redmine tab of the project? just the installation path of redmine or including also the project name like "https://the.redmine.domain/projects/foo-project" (Note: REST API is enabled)

PS: The commit message is something like "(#3) Done foo things".

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Do you have trace logging enabled (FAQ)?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


The scm server startup trace

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


The trace level had been enabled by default. But I don't see any log after the push process. Isn't that a bit strange? Please find the startup trace log attached.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


This is really strange, because the redmine-plugin does a lot of logging. Could you post the whole log output of a push?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Client side push operation output

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Sure please find the attached log file.It's the client side output. As I said before, it does not leave any traces in the server side log file.

My guess is the latest dependecy adjustment completely disabled the plugin. It's there but doing nothing.

P.S: Again, what should be the URL parameter of the redmine tab? Just the domain, or should include the project path?

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Sorry, i mean the scm-manager log output.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


I've edited the post but you have seen before it :) No traces in the server side log after a push.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Did you mean the server prints no single line to the log, when you do a push?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Yes. Right now I'm reverting back to see the this situation with 1.36 setup.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


I tried with the old setup and it's the same. No logs after a push. To make sure about it I'm deleting the contents of the log file before push (not deleting the file because interestingly scm-server does not create it again).

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Are you sure that you check the right log file? Could you please execute the following command on the machine which runs scm-manager:

#!bash

ls -l /proc/$(ps -ef | grep scm-server | grep -v grep | awk '{print $2}')/fd | grep -e '.log$'

And check if the log the same you are check for updates.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


[Back to 1.37 Snapshot]

Command result:

#!bash

ls: cannot access 20237/fd: No such file or directory

What do you mean with "checking updates". If you mean checking updates for scm-server I didn't see something like that. If you mean pulling from repos, it also didn't create any traces in the log.

The log file I sent is the same I'm looking. It's updated while startup but that's it. No logs for pull or push.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


To see what's going on under the hood I've stopped the daemon and run scm-server manually. Then I have been able to see the real log. (Although the log file still didn't include anything). Here, the push log is attached (taken from the SSH output of scm-server)

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Server push log

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


I mean checking the log file for updates (new lines). Did you see new lines, if you access the web interface with a browser? Please execute:

#!bash

ls -l /proc/20237/fd | grep -e '.log$'

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


#!bash

ls: cannot access /proc/20237/fd: No such file or directory

Unfortunately no new lines. I think after the startup, logging is gone because the link is not there anymore. Somehow scm-server loses the connection with the log file. But I can give you the traces from the SSH output from now on.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Ok, but here is the exception message for the redmine problem:

#!text

com.taskadapter.redmineapi.RedmineAuthenticationException: Authorization error. Please check if you provided a valid API access key or Login and Password and REST API service is enabled on the server.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Since REST API, username and password is OK, there should be something wrong with API key. What is that and how can I supply it?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


OK, the error says "API key OR login details". The login details are the same and REST is enabled. I'm suspecting from the username, it includes a dot, could it be the issue?

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Sorry, but i don't know redmine very good. But i've seen this error before and in that case the url was wrong. You have to insert the url inclusive context url (something like this http://myredmineserver/redmine/). You could check the access log from your webserver (which hosts redmine), which urls are triggered by the scm-manager plugin. You can open the rest urls directly in your browser to see the result.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Thanks, I'll check the web server logs to see what's going on.

What about the log issue? Why is scm-server not writing any logs after startup?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Sebastian,

I've investigated the access logs and seen the line below

#!

"GET /issues/3.json?include= HTTP/1.1" 401 1388 "-" "-"

I've applied the "https://the.redmine.domain/issues/3.json?include=" from the browser and it asked for credentials. After that I've seen the REST API response successfuly.

It also can be seen from the log. Webserver is sending "401" which is an authorization request. That means redmine plugin should be accepting self signed certificate and can access to the server.

But I don't know how to check the authorization result.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Sebastian,

I've narrowed down the problem and it really looks like an authorization issue. I've tested the connection with lynx browser inside the server and had seen a certificate common name issue. Fixed that and then approved with a proper username password, I can get all the REST API information I need, using the exact address redmine plugin uses.

So I need to see the authorization data and actual response from the apache2 server. Setting the LogLevel to debug didn't help, couldn't see the authentication result.

Do you have any idea how to see these information? It's not related to Redmine, everything is going on between redmine plugin and Apache server. (Maybe you can turn on logging sent username password and taken response. This way we can see the real issue.

P.S: The same redmine plugin 1.1 is working fine on a windows server with SCM Manager 1.22, without SSL on IIS7.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Sebastian,

I can't pass this problem and want to try the API key method. Could you tell me how can I authenticate to redmine with an API Key?

Thanks.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


I'm do not how to setup the api key method. Perhaps you could write @velo he is the author of the redmine-plugin. It is possible that you call redmine over http instead of https, just to be sure that the problem has nothing todo with the ssl setup?

@cesmarvin
Copy link
Contributor Author

Original comment by Marvin Froeder (Bitbucket: [Marvin Froeder](https://bitbucket.org/Marvin Froeder), ).


I'm no longer working using SCM nor redmine (new company, new setup).

But I can give full access to anyone that wanna maintain this plugin.
Just send me the names!

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Sebastian,

We ruled out the SSL parameter. I've tried plain HTTP and it also failed. I think the only option is really try to make the plugin work from inside. Velo's suggestion is tempting but I don't know whether I can maintain it or not. I'm not familiar wth SCM Manager plugin structure and have very few Java knowledge.

P.S: I've tried the newly released 1.37 and the issue is still there as expected.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Another finding: As I suspected, redmine plugin does not really try to authenticate. While trying to update issue, it still uses the "anonymous" user not the scm-manager's user. It's logged in the redmine logs.

It's the same plugin which works perfectly in the older scm-manager on Windows Server. Why does not work on the newer SCM Server on Linux? It could be somehow related to the log issue of SCM Manager. Don't know.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Ok, i think i found the problem. It looks like the hook of the redmine-plugin conflicts with the hook for the last modified date of the repository. Could you please test the version below:

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Unfortunately it didn't help. Still no authorization. I've looked to the code in the plugin repository and couldn't see any authentication code. How can we be sure that it tries to authenticate?

Please find the attached push trace log.

Here, also the redmine log:

#!

Started GET "/issues/3.json?include=" for 127.0.0.1 at 2014-04-24 07:52:35 +0000
Processing by IssuesController#show as JSON
  Parameters: {"include"=>"", "id"=>"3"}
  Current user: anonymous
Filter chain halted as :check_if_login_required rendered or redirected
Completed 401 Unauthorized in 2.6ms (ActiveRecord: 0.4ms)

Here's the successful inside attempt with lynx browser

#!

Started GET "/issues/3.json?include=" for 127.0.0.1 at 2014-04-24 08:07:22 +0000
Processing by IssuesController#show as JSON
  Parameters: {"include"=>"", "id"=>"3"}
  Current user: murat.ursavas (id=3)
  Rendered issues/show.api.rsb (8.2ms)
Completed 200 OK in 84.9ms (Views: 8.7ms | ActiveRecord: 8.9ms)

Can you add a log trace to the plugin while trying to authenticate?

PS: There is one good news, though, what you've done, solved the log issue. Now I can see the push log in the log file. So please keep this change in the repo.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


By the way, I've investigated the API Key method and it's not a good idea to use API Key for authentication. This way you have to keep an API Key for every person per project (The projects does not have to be on the same redmine server).

So, we should keep the username/password usage for authentication.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


You can change the log level of the root logger to trace, with this option you should see the whole http traffic in the log file.

#!xml

  <root level="TRACE">
    ...
  </root>

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


I don't know Klingon language, I'll be happy if you can look at the attached extended log :)

P.S: The logging gone again, I don't understand what happens, the version is still the same.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


The plugin sends a password to the redmine server. I send you a bitbucket message with the credentials.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


And the credentials are correct. So, what about the response? Does the server accept it?

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


No, the server responds with "401 Authorization Required".

I've done some tests:

  • installed redmine (on linux mint 15)
  • installed scm-server-1.38-20140424.064716-1-app.zip
  • installed scm-redmine-plugin
  • created a user admin with password admin on scm-manager to match the default
    redmine account
  • created a test repository on scm-manager with write permissions for the user admin
  • configured redmine-plugin to update issues
  • created a redmine project
  • created a sample issue (id=1)
  • submit a push to the test repo with commit message "update issue (HTTP ERROR 500 when using hgweb on Windows #1)"

The whole process works like expected. Is the user privileged to update issues on the redmine project? Could you test it, with an other user? Does redmine write logs with some informations on permissions?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


I had started to suspect from the redmine installation and your findings made it more definite. I've read also some authentication issues on the web about redmine integration. So this is clearly related to redmine but how does this change. What's inside the HTML header makes this not work. Interesting.

I have to look deeper for an extended logging for redmine, since I don't know very well the inner gears of it.

P.S: Yes, the user is eligible to update the issue.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Something is not right with my setup. Like SCM Manager, Redmine is also losing the connection with the log file after the startup. Do you have any idea about the cause? Maybe log rotation?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


I somehow managed to get the logs of the attempt and looks like the request comes to the redmine as anonymous. I think I have something wrong with my Apache settings.

Could you post the apache settings you use? Especially authentication. For example I have this:

#!

AuthUserFile /dev/null

I guess it's not basic authentication. Maybe mod_passenger?

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Yes, i've used mod_passenger. For the logging issues, you should check your machine for io problems.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


There is definitely something wrong with the setup but it's very hard to find the malfunctioning part without proper logs. Because the only problematic part is the plugin. Everything else just works. I'm suspecting from the HTTP header redmine plugin uses but I have to find a way to debug it to detect why it differentiates in my setup.

Again, could you post your apache site settings? Maybe it's the key.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


My apache configuration is very simple:

#!xml

<Directory /var/www/redmine>
  RailsBaseURI /redmin
  PassengerResolveSymlinksinDocumentRoot on               
</Directory>

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


Could you please test the version 1.2 of the plugin?

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Finally. It is solved... It was eating me from inside. What was the trick, Sebastian? (I got a hunch about HTTP header)

By the way I've seen that the issue update has some issues (recursive :)

Here's the added sample update. (Redmine 2.5.1, latest stable)


[SCM] (#3) Just testing SCM Manager Redmine plugin.

Changes: https://rascom.rasatron.com:8181/scm/index.html#diffPanel;CqOZNBtzP2;6ebdd882c24e48b180a8973210a098d96e21e1b1

Patch: https://rascom.rasatron.com:8181/scm/api/rest/repositories/CqOZNBtzP2/diff?revision=6ebdd882c24e48b180a8973210a098d96e21e1b1


As you can see the added link ref can be seen in the issue update. I guess it's because of the redmine link style and HTML character escaping.

Also could you please change the commit and patch link style? It makes the issue messages too crowded. A simple "Changes, Patch" would be just fine (of course with their links.)

It is very simple to do. Here:

#!

"Changes":https://rascom.rasatron.com:8181/scm/index.html#diffPanel;CqOZNBtzP2;6ebdd882c24e48b180a8973210a098d96e21e1b1 "Patch":https://rascom.rasatron.com:8181/scm/api/rest/repositories/CqOZNBtzP2/diff?revision=6ebdd882c24e48b180a8973210a098d96e21e1b1

Thanks for your efforts. I really appreciate it.

@cesmarvin
Copy link
Contributor Author

Original comment by Sebastian Sdorra (Bitbucket: sdorra, GitHub: sdorra).


The trick was to update the java redmine connector. Could you please create a new ticket for the link problems.

@cesmarvin
Copy link
Contributor Author

Original comment by Murat Ursavas (Bitbucket: muratursavas, GitHub: muratursavas).


Sure. Thanks again.

@cesmarvin cesmarvin added minor bug Something isn't working labels Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant