mapbox / mapbox-studio-classic

https://www.mapbox.com/mapbox-studio/
BSD 3-Clause "New" or "Revised" License
1.14k stars 229 forks source link

Win7/64-bit: crash on 'Download MBtiles' #1211

Closed relet closed 9 years ago

relet commented 9 years ago

Creating tiles from a single PostGIS table. I have the source project saved, open mapbox studio, select 'settings', 'Download MBTiles', then the client exits with code 8.

[8256:0224/111014:INFO:CONSOLE(0)] <Tue, 24 Feb 2015 10:10:14 GMT> Mapbox Studio @ http://localhost:3000/
[4064:0224/111014:INFO:renderer_main.cc(211)] Renderer process started
[5800:0224/111015:ERROR:ipc_channel_win.cc(460)] pipe error: 232
[6160:0224/111018:INFO:renderer_main.cc(211)] Renderer process started
[8256:0224/111018:INFO:CONSOLE(0)] <Tue, 24 Feb 2015 10:10:18 GMT> Mapbox Studio exited with 8.

I checked a few of the tickets that may be related. There is nothing in the file app.log:

<Tue, 24 Feb 2015 10:10:14 GMT> Mapbox Studio @ http://localhost:3000/

Restarting the machine, and deleting the cache manually had no effect. I can create a copy of the dataset if that helps, but it seems to occur for all my projects.

Anything else I could check?

wilhelmberg commented 9 years ago

@relet could you give some more information about your machine?

You could try deleting %USERPROFILE%\.mapbox-studio (<-- enter this into the address bar of file explorer) completely (you will have to re-authenticate afterwards).

If that doesn't help, it would be great if you could go through these steps and provide a screenshot of the ECHOs and a download of the DMP files, so that we get some more information: Part 1 - Debug Mapbox Studio

relet commented 9 years ago

Windows 7 64bit (Enterprise ) as the ticket says, Mapbox Studio is also 64bit.

Deleting the stored settings had no effect.

None of the environment variables are set.

procdump yields:

[08:49:32] Exception: E06D7363.?AVdatasource_exception@mapnik@@
[08:49:32] Dump 1 initiated: C:\Program Files\node.exe_150225_084932.dmp

https://drive.google.com/file/d/0B7wcsWcf-oh1di1fVklwZk1mQWM/view?usp=sharing

wilhelmberg commented 9 years ago

@relet

as the ticket says

yeah, sorry. I somehow missed that :smile:

Thanks for sending the the dump file. I now I have an entry point where to start investigating.

Is it fine with you, if I send a special debug build version (hopefully tomorrow) and you repeat the above process?

relet commented 9 years ago

Sure can do. :)

wilhelmberg commented 9 years ago

@relet

I got a file for you (~90MB download, extracts to +2.2 GB): https://mapnik.s3.amazonaws.com/dist/dev/node-v11-win32-x64.7z

Please replace the folder node-v11-win32-x64 in

C:\Program Files\mapbox-studio\resources\app\node_modules\mapnik\lib\binding

with the contents of the 7z-file.

Then run these steps again: Part 1 - Debug Mapbox Studio.

relet commented 9 years ago

With the debug version, I get an error that my geometry_table does not exist, which is correct. I accidentally entered the database name.

Postgis Plugin: ERROR:  relation "world_map" does not exist ...

And it does not let me open the previously saved tm2source file. Trying to recreate the mistake results in the same error.

Now I'm just a bit puzzled as to why the non-debug version let me create the file with a nonexistant geometry_table, and actually displayed data. If I create the correct source file and compare the data.yml configuration, the only difference is the geometry_table field.

wilhelmberg commented 9 years ago

Now I'm just a bit puzzled as to why the non-debug version let me create the file with a nonexistant geometry_table

I've used latest node-mapnik source to create the debug package and node-mapnik 3.1.5 landed some changes concerning detection of geometry_table: Improved auto-detection of geometry_table from sql subselects for PostGIS plugin https://github.com/mapnik/node-mapnik/blob/master/CHANGELOG.md#315

The current download of Mapbox Studio 0.2.5 ships with node-mapnik 3.1.2 and doesn't yet have these changes.

Do I understand correctly that the right SQL statement solved the problem?

relet commented 9 years ago

Yes, the export works fine now. Thank you for helping out! :) On 27 Feb 2015 17:23, "Wilhelm Berg" notifications@github.com wrote:

Now I'm just a bit puzzled as to why the non-debug version let me create the file with a nonexistant geometry_table

I've used latest node-mapnik source to create the debug package and node-mapnik 3.1.5 landed some changes concerning detection of geometry_table: Improved auto-detection of geometry_table from sql subselects for PostGIS plugin https://github.com/mapnik/node-mapnik/blob/master/CHANGELOG.md#315

The current download of Mapbox Studio 0.2.5 ships with node-mapnik 3.1.2 and doesn't yet have these changes.

Do I understand correctly that the right SQL statement solved the problem?

— Reply to this email directly or view it on GitHub https://github.com/mapbox/mapbox-studio/issues/1211#issuecomment-76422160 .

wilhelmberg commented 9 years ago

Perfect! :rocket:

You are welcome.

springmeyer commented 9 years ago

If anyone else hits this one thing to try is to edit https://github.com/mapbox/mapbox-studio/blob/mb-pages/lib/middleware.js#L168 and add a console.log to print any error that occurs there. If an error does occur there it should then show up in the ~/.mapbox-studio/app.log. My hunch is that there are a variety of different errors that might cause a source to not show up and that they may not be correctly showing in the UI. So this console print should, again, show them in the log.

diff --git a/lib/middleware.js b/lib/middleware.js
index e4842ee..db4ddcb 100644
--- a/lib/middleware.js
+++ b/lib/middleware.js
@@ -165,7 +165,10 @@ middleware.writeSource = function(req, res, next) {

 middleware.loadSource = function(req, res, next) {
     source(req.query.id, function(err, s) {
-        if (err) return next(err);
+        if (err) {
+            console.log(err)
+            return next(err);
+        }
         if (!source.tmpid(s.data.id)) tm.history(s.data.id);
         req.source = s;
         req.style = s.style;