Skip to content

Instantly share code, notes, and snippets.

@bhmj
Created December 12, 2017 15:00
Show Gist options
  • Save bhmj/be96055a67496d5bf3d3ae2ade2c4855 to your computer and use it in GitHub Desktop.
Save bhmj/be96055a67496d5bf3d3ae2ade2c4855 to your computer and use it in GitHub Desktop.
Segmentation fault in Tarantool 1.7 + GIS
-- Tarantool version: 1.7.6-11-gcd17b77f9
-- FROM tarantool/tarantool:1.7
zs = box.schema.create_space('sample_zone', { if_not_exists = true })
zs:create_index('primary', { parts = { 1, 'int' }, type = 'HASH', unique = true, if_not_exists = true })
-- Cursed polygon with two holes in it
zs:insert{1, 'Far East', 'POLYGON Z ((-2116413.010898654 -485212.4311468988 5977058.340666953, -1216758.134463327 777728.5279088513 6191679.753470818, -674191.3194526833 1427880.005176583 6158864.858202126, -629030.4156373634 1589056.133211155 6124301.929899786, -633175.4298991745 1667203.105713795 6103205.222476686, -677463.2468220373 1788075.430592301 6064371.820805638, -798617.4993910231 1894407.169829421 6017476.697452837, -633903.9618720796 2151497.528178517 5950731.220882745, -755754.5038707128 2513495.795935149 5793581.829679735, -754218.6821475578 2633780.319049045 5740461.743806336, -949170.5443766854 2674943.042375596 5692625.628629934, -1087039.827162265 2885373.82501458 5564611.937203013, -1098510.062624966 3094751.339444525 5449429.637588077, -1271223.753084213 3003693.907334234 5462721.769497646, -1367809.236572828 2832693.090358151 5529872.419201068, -1480955.992222856 2836974.973410929 5498654.73384565, -1583111.708003311 2861886.038537163 5457405.330576935, -1738011.636847947 3025011.995357286 5321503.342012172, -1814405.597934966 2964570.062138517 5329955.885737799, -2002075.755117022 2943243.119881315 5274669.373255294, -1960951.252736414 2884614.382017817 5321974.828188306, -1983989.730779918 2869152.639276557 5321795.44598025, -1955982.799847974 2756877.952111477 5390598.005117791, -1971612.693527782 2745757.628128207 5390579.872400863, -2022932.762985039 2842928.628623613 5321212.32087729, -2029094.090932113 2837975.28768115 5321508.517921967, -2065335.20128882 2902996.459043494 5272596.4951957, -2340706.823923307 2726370.36716548 5251926.69694759, -2212486.648786985 2534568.880924039 5400457.203135728, -2219864.851201761 2406812.65311479 5455228.711602171, -2374035.567262434 2173291.965961155 5488023.8564287, -2281576.425601109 2054629.34677279 5571742.616738179, -2279245.701870939 1868096.362261256 5637525.519191818, -2526526.112088854 1629184.126599955 5606355.842544078, -2613913.764740581 1691771.707794159 5547843.084089166, -2609544.439795005 1774551.5034916 5524148.120256707, -2703222.502083517 1737346.39806187 5491050.929150056, -2754083.011616873 1782836.569746946 5451318.678718143, -2823677.091495958 1593387.815238122 5474178.888959941, -2824737.631353528 1590492.660309278 5474471.696959293, -2822677.408142397 1590543.887546796 5475512.354369096, -2820885.41040855 1583920.805113037 5478335.977869073, -2816280.032168674 1582555.89051092 5481080.697105198, -2812898.759483681 1577485.978950811 5484256.180969953, -2812928.455946023 1572499.059385389 5485663.448628277, -2799015.719501243 1572214.560128116 5492808.659588791, -2759466.062705842 1554962.610674679 5517508.504111766, -2781854.793968848 1529672.970267702 5513361.458841204, -2831077.829741467 1547540.368793035 5483439.142103766, -2845974.858615378 1552209.36198411 5474461.063396342, -2840885.397462827 1574991.804342868 5470621.9843684, -2835687.806514934 1582561.479855204 5471130.61806809, -2829695.661639833 1583299.71046009 5473999.387017288, -2826706.517909433 1590267.869757301 5473527.017885184, -2821163.874910514 1601216.463325013 5473196.893501258, -2920041.236690759 1614968.193010361 5417386.568398623, -2998949.300515138 1379570.790318547 5439148.424607635, -2968393.273393979 1015777.391517721 5534530.830972492, -2894035.779869797 914890.3831468151 5590841.102595207, -2866459.56817472 915914.3470061113 5604768.623739432, -2869110.002842875 903155.6554003312 5605478.117265911, -2856250.589716733 898106.9343705189 5612802.332276572, -2843362.470369087 912939.9636036686 5616923.72078913, -2842668.584020031 878760.2790164503 5622684.494003263, -2718070.1335133 830457.7055264687 5690765.240675805, -2698394.91752051 837609.3018271391 5699018.88408094, -2688335.775717564 822688.7664154029 5705895.730508592, -2666361.299948212 826819.0315107701 5715536.523103049, -2651729.50651402 784957.4257017286 5728147.162251012, -2597396.705688266 784480.2098890862 5752886.610448091, -2643304.995874471 675588.8626230931 5745837.438225166, -2664558.009825856 670680.0178345096 5736650.533588907, -2672457.889484087 647377.841608547 5735659.318341957, -2681223.256539207 617262.9543854881 5734893.594960099, -2667701.880971868 611112.3975096089 5741807.190811271, -2706563.841082375 587436.8230810523 5726174.975233626, -2713746.578405376 562563.9362035374 5725279.046904885, -2776899.408927594 508406.6368859914 5700175.804182746, -2801768.940759187 518035.6939372483 5687211.671152833, -2840072.890072247 574441.3660869726 5662906.415820206, -2933318.545638532 495763.1012088803 5622935.83759084, -2935609.015744611 315295.7388615025 5634664.552211204, -3007314.761924138 271650.2082104708 5599250.098058183, -2991238.340223111 25233.01078562039 5614272.770777064, -2832431.029323153 -381276.4498068144 5682863.94900061, -2559523.543555785 -478413.3315406087 5802899.970147005, -2116413.010898654 -485212.4311468988 5977058.340666953), (-1873639.406596988 2245851.511603989 5648999.25422598, -1914241.674051137 2285305.607184208 5619684.123909089, -1916506.52509321 2290688.556831579 5616739.642489706, -1917384.406341731 2292386.682056135 5615753.778976626, -1919224.61689774 2297197.328147323 5613176.154464215, -1923157.802003832 2304214.973760604 5608980.299349297, -1924215.541091158 2313314.537885103 5604897.99188861, -1930210.424976254 2325662.333885812 5597770.240994284, -1929934.793823969 2343996.815162682 5590263.490291799, -1928018.968574875 2352889.757509578 5587208.431216172, -1928873.916686401 2366361.973834911 5581260.567756942, -1925982.205926897 2379147.645881756 5576851.592042991, -1921251.376537846 2394037.428155687 5572141.10894284, -1901435.040749207 2407956.448373419 5572935.443868703, -1883376.941804552 2423863.829371123 5572176.53776503, -1843824.223777398 2446497.701714785 5575489.954052823, -1769291.392299595 2400449.382079822 5619188.626638331, -1806730.903404664 2345198.104183285 5630518.659070485, -1881545.173418935 2319310.284107187 5616813.819880375, -1864730.474078532 2251948.219630004 5649516.466364625, -1873639.406596988 2245851.511603989 5648999.25422598), (-1158443.327960737 2652961.69087362 5664291.970606027, -1218081.923126027 2685257.060763241 5636681.122192548, -1239801.610153359 2733486.327989756 5608881.75021887, -1255288.586386562 2751879.555098471 5596512.628869973, -1329134.292691935 2831415.871370594 5539880.93184769, -1321261.872433575 2837776.753389084 5538518.433128616, -1313845.259683033 2843011.333536799 5537604.328438522, -1270460.666215463 2802946.617162525 5567864.905251678, -1260702.839960222 2784085.594486565 5579455.584668315, -1257258.4605383 2784203.402006391 5580169.153472617, -1232634.44432409 2772706.689442924 5591301.013537033, -1205094.058216283 2749727.155041632 5608510.229665194, -1183712.16702963 2695314.038074683 5639186.156013572, -1101177.071287228 2684468.278652417 5660892.052186123, -1104394.139571134 2674039.208806231 5665170.87046526, -1158443.327960737 2652961.69087362 5664291.970606027))'}
gis = require('gis')
function sample_test()
for _, zone in pairs(box.space.sample_zone:select()) do
local poly = gis.wkt.decode(zone[3], 4328)
local tpoly = poly:transform(4326) -- CURSED LINE
end
end
-- segfaults in quite a few iterations.
-- May also crash *after* the loop completes.
for i=1,8192 do sample_test() end
--[[
Segmentation fault
Current time: 1513090213
Please file a bug at http://github.com/tarantool/tarantool/issues
Attempting backtrace... Note: since the server has already crashed,
this may fail as well
#0 0x7f0f59210909 in print_backtrace+9
#1 0x7f0f5913d2c9 in _ZL12sig_fatal_cbi+89
#2 0x7f0f58ed9e17 in sigwaitinfo+8
#3 0x7f0f5926bb7b in lj_ccall_func+3db
#4 0x7f0f592804f6 in lj_cf_ffi_meta___call+36
#5 0x7f0f592263c7 in lj_BC_FUNCC+34
#6 0x7f0f592284e1 in gc_call_finalizer+71
#7 0x7f0f5922864d in gc_finalize+13d
#8 0x7f0f5922908f in gc_onestep+9f
#9 0x7f0f59229764 in lj_gc_step+54
#10 0x7f0f592679ac in lj_trace_exit+30c
#11 0x7f0f59227f73 in lj_vm_exit_handler+e1
#12 0x3ff0000000000000 in +e1
Loading existing configuration file: /etc/tarantool/config.yml
Config:
---
pid_file: /var/run/tarantool/tarantool.pid
vinyl_dir: /var/lib/tarantool
slab_alloc_arena: 4
memtx_dir: /var/lib/tarantool
wal_mode: write
listen: 3301
snapshot_period: 3600
replication: []
wal_dir: /var/lib/tarantool
...
--]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment