kandanapp / kandan

Kandan is an Open Source Alternative to HipChat
GNU Affero General Public License v3.0
2.72k stars 408 forks source link

Won't Load Previous Messages #358

Closed johnjelinek closed 9 years ago

johnjelinek commented 10 years ago

Loading previous messages continues spinning and never loads previous messages:

windows_server_2012_r2_datacenter

scouttyg commented 10 years ago

Have you pulled in the latest? I know there was an issue there before that should have been solved in #350.

Does the rails server log report any errors?

johnjelinek commented 10 years ago

No errors logged that I can tell, I have the latest. What's the file path I should be watching? On May 12, 2014 5:59 PM, "scouttyg" notifications@github.com wrote:

Have you pulled in the latest? I know there was an issue there before that should have been solved in #350https://github.com/kandanapp/kandan/pull/350 .

Does the rails server log report any errors?

— Reply to this email directly or view it on GitHubhttps://github.com/kandanapp/kandan/issues/358#issuecomment-42899198 .

scouttyg commented 10 years ago

The filepath to watch for logging if on development would be development.log (ie, tail -f log/development.log from the main Kandan directory.

As for why it's not loading earlier messages, it's hard to tell. Did you try different browsers? Are you running it on a nonstandard configuration? (I know you have another issue on running it with Phusion Passenger and nginx -- could it be related to that?)

johnjelinek commented 10 years ago

I'll check development.log, in this case I'm just using thin+nginx. Running in chrome on windows. On May 12, 2014 6:22 PM, "scouttyg" notifications@github.com wrote:

The filepath to watch for logging if on development would be development.log (ie, tail -f log/development.log from the main Kandan directory.

As for why it's not loading earlier messages, it's hard to tell. Did you try different browsers? Are you running it on a nonstandard configuration? (I know you have another issue on running it with Phusion Passenger and nginx -- could it be related to that?)

— Reply to this email directly or view it on GitHubhttps://github.com/kandanapp/kandan/issues/358#issuecomment-42900820 .

johnjelinek commented 10 years ago

@scouttyg I'm not finding a log/development.log path. Is it supposed to be in kandan/ or something like /var/log/...?

johnjelinek commented 10 years ago

Here's my kandan/ tree:

(suppressed to save space)
616 directories, 1573 files
johnjelinek commented 10 years ago

Looks like logs only print to STDOUT in development: https://github.com/kandanapp/kandan/blob/master/config/environments/development.rb#L38-L41. In which case, according to the output there, I don't notice any related errors:

$ cat kandan.stdout | grep Er
ActionController::RoutingError (No route matches [GET] "/browserconfig.xml"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/tmyk"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/makeitso"):
ActionController::RoutingError (No route matches [GET] "/secret"):
ActionController::RoutingError (No route matches [GET] "/secret"):
Completed 500 Internal Server Error in 127523.2ms
Errno::ETIMEDOUT (Connection timed out - connect(2) for "pbs.twimg.com" port 443):
Completed 500 Internal Server Error in 127289.0ms
Errno::ETIMEDOUT (Connection timed out - connect(2) for "pbs.twimg.com" port 443):
Completed 500 Internal Server Error in 127378.3ms
Errno::ETIMEDOUT (Connection timed out - connect(2) for "pbs.twimg.com" port 443):
scouttyg commented 10 years ago

It might be best to watch your rails server and see if you see any errors run through it. IE clear it right before you trigger the earlier messages (command K on Mac), then see what it looks like. Mine looks like this for example:

screen shot 2014-05-13 at 3 25 35 pm

johnjelinek commented 10 years ago

No errors come through.

Started GET "/" for 172.17.0.3 at 2014-05-13 19:31:59 +0000
Processing by MainController#index as HTML
  User Load (0.6ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
  Channel Load (0.3ms)  SELECT "channels".* FROM "channels"
  Activity Load (1.8ms)  SELECT "activities".* FROM "activities" WHERE "activities"."channel_id" IN (1, 3)
  User Load (0.8ms)  SELECT "users".* FROM "users" WHERE "users"."id" IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
  Rendered main/_sidebar.html.erb (1.8ms)
  Rendered main/_nav.html.erb (0.1ms)
  Rendered main/index.html.erb within layouts/application (7.4ms)
  Rendered layouts/_header.html.erb (0.3ms)
  Rendered layouts/_messages.html.erb (0.0ms)
Completed 200 OK in 92.9ms (Views: 69.7ms | ActiveRecord: 3.6ms)
  Channel Load (0.2ms)  SELECT "channels".* FROM "channels" WHERE "channels"."id" = ? LIMIT 1  [["id", 1]]
   (0.0ms)  begin transaction
  SQL (0.9ms)  INSERT INTO "activities" ("action", "channel_id", "content", "created_at", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?)  [["action", "disconnect"], ["channel_id", 1], ["content", nil], ["created_at", Tue, 13 May 2014 19:31:59 UTC +00:00], ["updated_at", Tue, 13 May 2014 19:31:59 UTC +00:00], ["user_id", 2]]
   (2.0ms)  commit transaction

Started GET "/channels" for 172.17.0.3 at 2014-05-13 19:32:01 +0000
Processing by ChannelsController#index as JSON
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
  Channel Load (0.4ms)  SELECT "channels".* FROM "channels" WHERE ('t'='t')
   (0.2ms)  SELECT COUNT(*) FROM "activities" WHERE "activities"."channel_id" = 1
  Activity Load (0.4ms)  SELECT "activities".* FROM "activities" WHERE "activities"."channel_id" = 1 ORDER BY id DESC LIMIT 30 OFFSET 0
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" IN (2, 15, 4, 7, 10, 3, 5)
   (0.4ms)  SELECT COUNT(*) FROM "activities" WHERE "activities"."channel_id" = 3
  Activity Load (0.2ms)  SELECT "activities".* FROM "activities" WHERE "activities"."channel_id" = 3 ORDER BY id DESC LIMIT 30 OFFSET 0
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" IN (4, 2)
  Rendered text template (0.0ms)
Completed 200 OK in 75.2ms (Views: 0.8ms | ActiveRecord: 2.8ms)

Started GET "/active_users" for 172.17.0.3 at 2014-05-13 19:32:01 +0000
Processing by ApisController#active_users as JSON
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
Completed 200 OK in 5.4ms (Views: 3.9ms | ActiveRecord: 0.3ms)

Started GET "/users" for 172.17.0.3 at 2014-05-13 19:32:01 +0000
Processing by UsersController#index as JSON
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
  User Load (0.7ms)  SELECT "users".* FROM "users" WHERE ('t'='t')
Completed 200 OK in 22.1ms (Views: 10.6ms | ActiveRecord: 0.9ms)
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."authentication_token" = 'sjkF3v9YEzRJhzXLK5bz' LIMIT 1
  Channel Load (0.1ms)  SELECT "channels".* FROM "channels" WHERE "channels"."id" = ? LIMIT 1  [["id", 1]]
   (0.0ms)  begin transaction
  SQL (0.4ms)  INSERT INTO "activities" ("action", "channel_id", "content", "created_at", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?)  [["action", "connect"], ["channel_id", 1], ["content", nil], ["created_at", Tue, 13 May 2014 19:32:01 UTC +00:00], ["updated_at", Tue, 13 May 2014 19:32:01 UTC +00:00], ["user_id", 2]]
   (2.6ms)  commit transaction
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."authentication_token" = 'sjkF3v9YEzRJhzXLK5bz' LIMIT 1

Started GET "/channels/1/attachments" for 172.17.0.3 at 2014-05-13 19:32:01 +0000
Processing by AttachmentsController#index as JSON
  Parameters: {"channel_id"=>"1"}
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 2 LIMIT 1
  Channel Load (0.2ms)  SELECT "channels".* FROM "channels" WHERE "channels"."id" = ? LIMIT 1  [["id", "1"]]
  Attachment Load (0.2ms)  SELECT "attachments".* FROM "attachments" WHERE "attachments"."channel_id" = 1 ORDER BY created_at DESC
Completed 200 OK in 3.4ms (Views: 0.1ms | ActiveRecord: 0.6ms)
johnjelinek commented 10 years ago

Perhaps the errors are all client side, and these errors aren't being sent to the server for logging:

windows_server_2012_r2_datacenter

windows_server_2012_r2_datacenter

scouttyg commented 10 years ago

It very well might be issues with Faye.

When you hit earlier messages, you should see a method kind of like mine that I listed:

IE the app should be hitting ActivitiesController#Index with an "oldest" parameter (it's querying for earlier messages). If it's not doing that, there might be something bigger at play there.

johnjelinek commented 10 years ago

It seems like the issue goes away when I don't have nginx in front of kandan ... maybe nginx is messing up Faye? Sounds like my other issue: #355 but without Passenger this time.

johnjelinek commented 10 years ago

@scouttyg I made a discovery. It seems to be isolated to when my browser is a certain height. I have vertical monitors so my browser real-estate is:

> window.innerWidth
1206
> window.innerHeight
1809

If I bring down the size of the window, scroll to the bottom, and then begin to scroll up, then messages begin to load.

scouttyg commented 10 years ago

That's actually good to hear, because I was definitely getting stumped. I'll check it out and see if I can replicate that!

scouttyg commented 10 years ago

Ah, I think I figured it out -- so Kandan by default only shows the last X messages, and at the top of the container has a "Loading more messages" div constantly there. The idea being that as a user scrolls up, it will trigger the load of more messages. The code for that is:

    $container.bind 'scroll', =>
      if $container.scrollTop() <= 100 && !@loading_new_messages
        @loading_new_messages = true
        @loadMoreActivities($container)
      return

It binds the "load more activities" action to the scroll as you can see. The issue with that is that if you're able to load all the activities in your window at once to display (ie, a vertical display, or if you are zoomed out enough), there will be nothing to scroll -- so the "load more activities" action doesn't get loaded.

I'll see if I can fix this.

johnjelinek commented 10 years ago

Also noticed that on initial load at this browser size, the chat does not go all the way down to the bottom. After I resize and scroll down, then scroll up, and re-maximize, it all gets fixed.

loadpreviousmessages

Notice in my example, the initial admin disconnected message does not reach the bottom, but at the end of the gif, it does reach the bottom.

scouttyg commented 10 years ago

As a temporary fix for this, you should be able to change the file config/kandan_settings.yml to have a per_page option of something larger (that will load enough messages to give you a scrollbar initially). It's not a perfect fix, but it should work for now while I see if there is a better way.