ohmage / server

The ohmage server application.
37 stars 25 forks source link

troubleshooting phone-server communication #600

Closed jshslsky closed 11 years ago

jshslsky commented 11 years ago

This issue was originally for something else and it turned into a big debug session related to SSL certificates and the ohmage Ubuntu installer.

zhangway commented 11 years ago

I'm a master student. I've decided to write my master thesis about doing some analytics for football players. We'd like to import the data to ohmage and doing analytics by using R language.

I found myself not productive because I didn't manage to find a high-level description of the hierarchy of the source code. I think it would be better if you can give me some simple task to work on ohmage.

Thank you in advance.

jshslsky commented 11 years ago

Hi, I don't think you need to use ohmage to do this. You can use Open CPU directly. @jeroenooms https://public.opencpu.org

zhangway commented 11 years ago

Thanks for the rapid reply. We need the survey anyway because the head coach will hand out the survey to each player after each match. I would like to use ohmage as a foundation.

jshslsky commented 11 years ago

Well, the easiest way to use ohmage in that case is to have the players install the ohmage app. You can script your survey in XML.

zhangway commented 11 years ago

Yes. I did it. But I was stuck at the login process. The app said "Unable to communicate with server"

I set up the ohmage server locally. The client app (2.16.2) couldn't connect to the server. My server address is https://iad0.cs.uit.no/ohmage. It's not a public hostname; But I can access the website through the explorer on my phone.

I installed ohmage-server and ohmage-standalone.

jshslsky commented 11 years ago

Did you try the IP address?

stevenolen commented 11 years ago

Hi @zhangway, I think the trouble you're having here is because the ohmage android app appends /app to the server address you've entered, and makes all requests to that endpoint (in this case: https://iad0.cs.uit.no/ohmage/app). If your ohmage server isn't listening there, that is likely to be your problem. Try modifying the actual endpoint ohmage runs at to end in /app -- hopefully that will fix the issue.

zhangway commented 11 years ago

The same error. :(

zhangway commented 11 years ago

@stevenolen Thanks for your explanation. I have a doubt. I saw the source code of android-lib. The method handlelogin in AuthenticationUtilities.java. I didn't see /app was appended to the server address.

  1. Could you please point me where the code is?
  2. How to change the endpoint?
stevenolen commented 11 years ago

Perhaps the code tries both situations. I'm not too familiar with the phone source to point that out.

The other suggestion is that I notice you are using HTTPS. are you using a real cert, or a snakeoil cert? If you're using the snakeoil cert, it's likely that the phone's browser will allow you to visit the page, but the phone app itself will reject.

Are you familiar with the android sdk? Could you run logcat with the device when making login requests and paste the output?

zhangway commented 11 years ago

It gets the same error when using both https and http. I'm using snakeoil cert when the app connects to https://.

I pluged in my android phone and ran "adb logcat AuthenticationUtilities:V *:S". But no log was extracted.

zhangway commented 11 years ago

C:\adt-bundle-windows-x86_64\sdk\platform-tools>adb logcat AuthenticationUtilities:V *:S --------- beginning of /dev/log/system --------- beginning of /dev/log/main C:\adt-bundle-windows-x86_64\sdk\platform-tools>

stevenolen commented 11 years ago

@zhangway, I don't get any log in my stream when logging in and limiting by AuthenticationUtilities. try logcat without filtering and look for some 'OhmageApi' items.

zhangway commented 11 years ago

I couldn't paste here because of the comment limitation. Could you please send an email to my box? wzh000@post.uit.no. Thanks a lot.

stevenolen commented 11 years ago

@zhangway so that perhaps others can use this to debug in the future, a public method of sharing data like that is preferred. Could you use pastebin.com to send the log snippet?

zhangway commented 11 years ago

Done. Please search by "ohmage app login failed log".

stevenolen commented 11 years ago

can you send the link along? I'm not able find it by searching with that query..

zhangway commented 11 years ago

http://pastebin.com/m63vikht

stevenolen commented 11 years ago

ah, my fault -- I didn't realize you were running the opencpu-based ohmage installer. In this configuration, ohmage server is served from the /app endpoint and the gwt-frontend is served from /ohmage (which was where my confusion came from before.

If you put exactly: http://iad0.cs.uit.no/ (or the ip address directly: http://129.242.19.117/ ) in the server selection (most importantly, without any endpoint) it will work. I just tested with your server (using the IP directly) and received authentication failure, rather than unable to communicate with the server.

zhangway commented 11 years ago

It said the same error.

stevenolen commented 11 years ago

can you make a dummy account for me to test? When I set my server selection to http://129.242.19.117/ (note the trailing slash, and non-https) I was able to communicate from my device to your server just fine..

zhangway commented 11 years ago

User name: user_dummy Password: 12345678

stevenolen commented 11 years ago

screenshot_2013-09-20-15-47-40

Using ohmage 2.16.6 (from the play store) I was able to use your server to log in with that information. I've attached a screenshot with exactly what I typed. Perhaps you are running another app on your device that may inhibit off-device communication in some way?

zhangway commented 11 years ago

I logged in after reboot. :+1:

Could you please tell me why it failed on those two conditions:

  1. https
  2. "ohmage" was appended to the link

I had been stuck for three days....

stevenolen commented 11 years ago

absolutely!

  1. The app is very careful not to communicate with a server using an invalid HTTPS certificate. The 'snakeoil' certs in use by default on the installer you used are definitely in the "invalid" category. If you have a real cert, you can replace it with the snakeoil ones, restart apache and you'll be able to communicate with the server from the app via HTTPS (which is likely something you'll want when you deploy your project)
  2. The phone app communicates directly with ohmage backend, and the link which includes /ohmage is for the gwt-based web frontend. Using /ohmage is a bit awkward, and should really be /web (or something that doesn't suggest it is ohmage), I'll mention this to the dev who packages the installer. So, based on this, asking the phone to communicate with http://129.242.19.117/ohmage/ will prevent it from being able to talk to the ohmage server apis, as it is a direct link to the static frontend pages.

Hopefully this helps!

zhangway commented 11 years ago

I've decided to use ohmage for my master thesis and do some customization on ohmage. It's really difficult to sort out the hierarchy by looking though the source code.

Could you please send me some high-level documentation? I'd like to be deeply involved in this project. :)

zhangway commented 11 years ago

@stevenolen Thanks a lot for your step-by-step help of digging into the issue with me. Possibly there might be more question to you in the future. Hope it's not disturbing you~

stevenolen commented 11 years ago

@zhangway sure!!! we're happy that folks are using ohmage :+1:.

The majority of the documentation that I know of is in the wiki (existing apis, ACL and system structure). From the development side, that's the best place for answers.