Hi,
Thanks for this module. I've just installed it on my site: http://bit.ly/wmng42

It works great, but I'm seeing in the "Recent log messages" (watchdog) this error quite a bit:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'KDAL' for key 1: INSERT INTO {weather_metar} (icao, reported_on, next_update_on, sky_condition, temperature, dewpoint, wind_direction, wind_speed, pressure, visibility, sunrise_on, sunset_on, image, raw) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => KDAL [:db_insert_placeholder_1] => 1327121580 [:db_insert_placeholder_2] => 1327125300 [:db_insert_placeholder_3] => broken [:db_insert_placeholder_4] => 13 [:db_insert_placeholder_5] => 4 [:db_insert_placeholder_6] => 340 [:db_insert_placeholder_7] => 20.4 [:db_insert_placeholder_8] => 1012 [:db_insert_placeholder_9] => 16093 [:db_insert_placeholder_10] => 1327152480 [:db_insert_placeholder_11] => 1327189740 [:db_insert_placeholder_12] => night-broken [:db_insert_placeholder_13] => KDAL 210453Z 34011KT 10SM BKN024 13/04 A2987 RMK AO2 SLP110 T01280039 ) in drupal_write_record() (line 6888 of ,,,/includes/common.inc).

Any ideas?

Comments

toddy’s picture

Assigned: Unassigned » toddy
Status: Active » Postponed (maintainer needs more info)

Hi,

unfortunately, I cannot reproduce this bug. Have you maybe had an old installation of weather on that site? You could try to uninstall the weather module and install it again. Note, however, that this will remove all your configuration for weather.

Regards,
Tobias

rdeboer’s picture

I haven't seen the error for a while. Maybe we'll close this issue and I'll report again if it rears its ugly head again.

toddy’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Alright, thanks a lot for the feedback.

Morn’s picture

Version: 7.x-1.1 » 7.x-1.3
Priority: Normal » Minor
Status: Closed (cannot reproduce) » Active

Got a similar error (only once):
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Doppelter Eintrag 'EDDS' für Schlüssel 'PRIMARY': INSERT INTO {weather_metar} (icao, reported_on, next_update_on, sky_condition, temperature, dewpoint, wind_direction, wind_speed, pressure, visibility, sunrise_on, sunset_on, image, raw) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => EDDS [:db_insert_placeholder_1] => 1341960600 [:db_insert_placeholder_2] => 1341964320 [:db_insert_placeholder_3] => scattered [:db_insert_placeholder_4] => 17 [:db_insert_placeholder_5] => 15 [:db_insert_placeholder_6] => 210 [:db_insert_placeholder_7] => 5.6 [:db_insert_placeholder_8] => 1014 [:db_insert_placeholder_9] => 9999 [:db_insert_placeholder_10] => 1341977580 [:db_insert_placeholder_11] => 1342034640 [:db_insert_placeholder_12] => night-scattered [:db_insert_placeholder_13] => EDDS 102250Z 21003KT 9999 FEW060CB SCT110 17/15 Q1014 ) in drupal_write_record() (line 7013 of ..... /includes/common.inc).
The access came at an unusual time (01:15 am local time from 95.108.150.235 sticker00.yandex.ru).
Cannot reproduce the error.

deanflory’s picture

I too have received this error multiple times and am wondering if it's happening when a page with multiple reports of the same location are going on:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate
entry 'KRDU' for key 'PRIMARY': INSERT INTO {weather_metar} (icao,
reported_on, next_update_on, sky_condition, temperature, dewpoint,
wind_direction, wind_speed, pressure, visibility, sunrise_on, sunset_on,
image, raw) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
:db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7,
:db_insert_placeholder_8, :db_insert_placeholder_9,
:db_insert_placeholder_10, :db_insert_placeholder_11,
:db_insert_placeholder_12, :db_insert_placeholder_13); Array
(
[:db_insert_placeholder_0] => KRDU
[:db_insert_placeholder_1] => 1348260660
[:db_insert_placeholder_2] => 1348264380
[:db_insert_placeholder_3] => scattered
[:db_insert_placeholder_4] => 27
[:db_insert_placeholder_5] => 15
[:db_insert_placeholder_6] => 240
[:db_insert_placeholder_7] => 13
[:db_insert_placeholder_8] => 1016
[:db_insert_placeholder_9] => 16093
[:db_insert_placeholder_10] => 1348225380
[:db_insert_placeholder_11] => 1348269120
[:db_insert_placeholder_12] => day-scattered
[:db_insert_placeholder_13] => KRDU 212051Z 24007KT 10SM SCT050 SCT250
27/15 A3001 RMK AO2 SLP159 T02720150 56015
)
in drupal_write_record() (line 7036 of
/home/account/public_html/drupal/includes/common.inc).

beebop_cj’s picture

Hi guys, I've also encountered this problem

"MESSAGE PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'KHRO' for key 'PRIMARY': INSERT INTO {weather_metar}..."

and I could replicate it only when trying to load the same page from multiple calls at the same time.

Our solution (though maybe not very nice to alter the contrib module) was to insert the drupal_write_record() that was causing the exception, in a try-catch statement.

Does anyone have a better solution?

toddy’s picture

Status: Active » Fixed

This is fixed in git and will be part of the next release. Thanks for the bug report!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Added link to site where error occurs.

reis quarteu’s picture

Hi.

I have also received this error today. The log message is as follows:

PDOException:
SQLSTATE[23000]:
Integrity constraint violation:
1062 Duplicate entry 'geonames_2661604' for key 'PRIMARY':
INSERT INTO {weather_forecast_information} (geoid, utc_offset, last_update, next_update, next_download_attempt) VALUES
(
:db_insert_placeholder_0,
:db_insert_placeholder_1,
:db_insert_placeholder_2,
:db_insert_placeholder_3,
:db_insert_placeholder_4);
Array (
[:db_insert_placeholder_0] => geonames_2661604
[:db_insert_placeholder_1] => 120
[:db_insert_placeholder_2] => 2015-06-10 09:25:00
[:db_insert_placeholder_3] => 2015-06-10 16:00:00
[:db_insert_placeholder_4] => 2015-06-10 16:00:00
)
in _weather_parse_forecast()
(line 213 of /home/swisspre/public_html/sites/all/modules/weather/weather_parser.inc).

I'm using Weather module version 7.x-2.11 over a Drupal 7.37 installation.

Any help will be highly appreciated.

Many thanks in advance! :)

kevinn’s picture

I get this error on a daily bases, probably because there are multiple calls at the same time.
I added a patch.

kevinn’s picture

Priority: Minor » Critical
Status: Closed (fixed) » Needs review

Status: Needs review » Needs work

The last submitted patch, 10: weather-duplicate_entry-1412352-10-D7.patch, failed testing.

kevinn’s picture

StatusFileSize
new1.28 KB

The last submitted patch, 10: weather-duplicate_entry-1412352-10-D7.patch, failed testing.

kevinn’s picture

Version: 7.x-1.3 » 7.x-2.11
Status: Needs work » Needs review

  • toddy committed c066e17 on 7.x-2.x
    Issue #1412352: Integrity constraint violation
    
toddy’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.