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

Unable To Export Data #2937

Closed
pqhf5kd opened this issue Aug 25, 2019 · 18 comments
Closed

Unable To Export Data #2937

pqhf5kd opened this issue Aug 25, 2019 · 18 comments
Labels

Comments

@pqhf5kd
Copy link

pqhf5kd commented Aug 25, 2019

Describe the bug
I'm trying to export my data (just to keep a backup) using the Export to SQL button from the hosted MonicaHQ instance but I'm just getting a blank page. Some weeks back I was getting an error but I didn't submit a ticket at the time.

Screenshots
Clicking the button beings to load https://app.monicahq.com/settings/exportToSql, it finishes and literally a blank page is returned (no source code)

@asbiin asbiin added the bug label Aug 28, 2019
@mattdp
Copy link

mattdp commented Sep 22, 2019

@asbiin I am experiencing this issue as well, and it makes me nervous about continuing to put data into the system. Thank you for all your help building Monica!

@DieselDuz42
Copy link

DieselDuz42 commented Oct 8, 2019

I, too am experiencing this issue.

I dropped an email on Sept 9th and have gotten no response.

10/17/19
Still, no response ended up deleting all of my contacts in the system to unsubscribe.

@TomGranot
Copy link

This is fixed by now, at least on 2.4.* and 2.5.* which I ran today.

@mattdp
Copy link

mattdp commented Oct 19, 2019

@Tomgs I don't believe this is working - I tried on PC Firefox and Mac Chrome. I have 2K+ contacts so I would guess it's timing out for people with large databases and working for smaller ones.

@asbiin I'd be happy to investigate further - I've done a bit of work with databases in the past, but know very little about PHP / how projects are structured - can you point me in the right direction as to where this function is located in the codebase, and I'll try to do some research from there?

@TomGranot
Copy link

@mattdp Ah, sorry about that, my database is indeed smaller than yours.
Per your question:

The route that specific settings pages sits on is /settings/export, and it is redirected in the router here:

Route::get('/settings/export', 'SettingsController@export')->name('export');

The settings controller is defined here:

class SettingsController

If I'm not mistaken, than this is the thing that actually triggers the correct view inside that file:

* Display the export view.
*
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory
*/
public function export()
{
return view('settings.export');
}

This is that view:
https://github.com/monicahq/monica/blob/master/resources/views/settings/export.blade.php#L1-L51

And this is the button that triggers what is eventually giving you an empty page:
https://github.com/monicahq/monica/blob/master/resources/views/settings/export.blade.php#L41

If I'm not mistaken, this is where the export gets triggered:
https://github.com/monicahq/monica/blob/684ce6bc56e7bed079bdf8b1fdacb352e937e964/app/Console/Commands/ExportAll.php

It relies on this class to do its thing:
https://github.com/monicahq/monica/blob/684ce6bc56e7bed079bdf8b1fdacb352e937e964/app/Jobs/ExportAllAsSQL.php

But I can't really pinpoint the failing point without your input, since for me it's seemingly working.

@mattdp
Copy link

mattdp commented Oct 21, 2019

Thank you so much, @Tomgs , for taking your time to outline this to me! I will check this out when I have a few free hours.

@TomGranot
Copy link

TomGranot commented Oct 21, 2019

My pleasure @mattdp. I'll actually be attending an Hacktoberfest later this week (Wedensday) so if the hours match up we might be able to hack on it together. I'd really like to see this fixed, as this is one of the most awesome things about Monica - their SQL export actually exports all the things.

@mattdp
Copy link

mattdp commented Oct 21, 2019

TLDR: @djaiss @asbiin - within five seconds of submitting this comment I started an export on the hosted site. Odds are that's the only export with a close timestamp. Any chance you could send us whatever logging you get from that export failing, so we can move towards a fix during Tom's Hacktoberfest time Wednesday?

--

Very cool @Tomgs - want to let me know by emailing monicaissue at matthewfdupont.com what time/time zone you'll be hacking to see if we can sync?

Since I use the hosted version, I'm wondering what if anything I can do short of spinning up an instance of self-hosted with a few thousand contacts to help diagnose if the issue. I'd guess, as I'm sure you've already considered, that either

a) the export function you highlighted errors out somewhere along the way for something memory- or variable-size related
b) the export function you highlighted has a max query time that fails, or
c) the function works fine but the page returns before it's complete, and there's no way to hand off a payload that's a few seconds late to the frontend.

But I haven't been a dev for a few years so might be missing something obvious here.

@djaiss
Copy link
Member

djaiss commented Oct 21, 2019

It doesn't work in production indeed.
I've been trying to understand what's going on exactly, but I fail. I think I will have to put a lot of traces in place to see what's going on here. It works locally and in small instances, but at Monica's size, it just goes right into a 500 after a while.

I'll push a new PR soon with logs everywhere to understand this problem better. Sorry for the problems.

@asbiin
Copy link
Member

asbiin commented Oct 21, 2019

Hi @mattdp , and thank you @Tomgs for your expertise!
As @djaiss just mentionned, we are aware of the situation, but it's mindblowing right now as there is no error log at all. We are investigating...

@mattdp
Copy link

mattdp commented Oct 21, 2019

Thanks @djaiss and @asbiin , please let us know when the trace is in place—if you have any logs you can send about the issues once those traces are in place, I'm happy to try and dig a bit on what they mean in terms of changes needed.

I really appreciate the attention to this issue! It makes me much more comfortable building out long-term workflows relying on Monica when export works.

@djaiss
Copy link
Member

djaiss commented Oct 21, 2019

I've added some logs in production to understand what's going on.
So the problem in production is still unknown, but at least we see that it’s the contacts table that causes the problem. The script stops at the contacts table somehow. Going to investigate more.

@TomGranot
Copy link

TomGranot commented Oct 22, 2019 via email

@TomGranot
Copy link

TomGranot commented Oct 22, 2019 via email

@TomGranot
Copy link

Ah, just noticed it's an actual email there in your comment! I just went directly to the website. Emailing now.

@djaiss
Copy link
Member

djaiss commented Oct 30, 2019

The export process has been refactored and has been merged, and finally it works in production again. I hope it works for all users too. My vision is that exporting data is essential and core to the product.
We'll tag a new version soon.

@djaiss djaiss closed this as completed Oct 30, 2019
@mattdp
Copy link

mattdp commented Oct 30, 2019

@djaiss just checked and it works for me - thank you so much @djaiss ! I feel way more comfortable investing time in fleshing out my data in Monica with that in place, and appreciate all the effort to diagnose.

@github-actions
Copy link

github-actions bot commented Jan 9, 2021

This issue has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants