NodeMCU 1.0 - Exception 9 `Fatal exception 9(LoadStoreAlignmentCause):` I am getting this error in my code.
Fatal exception 9(LoadStoreAlignmentCause):

Using core version 2.4.2

Stack trace

Decoding stack results
0x40213e9c: dns_gethostbyname at core/dns.c line 1472
0x40204c21: ESP8266WiFiGenericClass::hostByName(char const*, IPAddress&amp;, unsigned int) at /home/tony/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp line 468
0x40205038: WiFiClient::connect(char const*, unsigned short) at /home/tony/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/libraries/ESP8266WiFi/src/WiFiClient.cpp line 98
0x4020306b: setPostString(int, int, Array8Int, char*) at /home/tony/Arduino/sketches/tempo1_vs11e_Master_NodeMCU_Rain_Wind/tempo1_vs11e_Master_NodeMCU_Rain_Wind.ino line 516
0x40203f8a: uploadAgrigis(char const*) at /home/tony/Arduino/sketches/tempo1_vs11e_Master_NodeMCU_Rain_Wind/tempo1_vs11e_Master_NodeMCU_Rain_Wind.ino line 335
0x40209080: Print::println() at /home/tony/.arduino15/packages/esp8266/hardware/esp8266/2.4.2/cores/esp8266/Print.cpp line 178
0x402048e0: loop() at /home/tony/Arduino/sketches/tempo1_vs11e_Master_NodeMCU_Rain_Wind/tempo1_vs11e_Master_NodeMCU_Rain_Wind.ino line 243


struct declaration

struct Array8Int {
    int array[8];
};


loop

char post[300] = "";
int pulseChange05m = rainCheck(slaveData);
int now10 = floor(unixtimeServer/10)*10;
Array8Int slaveData = slaveCheck(now()); // update slaveData array
setPostString(now10, pulseChange05m, slaveData, post);


functions

void setPostString(int unixtimeEvent, int pulseChange, Array8Int postData, char* postStr) {
  bool flag = true;
  float rainHour = pulseChange*0.25;
  if (hour() == 10) { // 7 AM palmital
    rainCount = 0;
    rainCount05m = 0;
  }
  rainCountHour = rainCount;
  int humidityBme280HourAvg = 0;
  int pressureBme280HourAvg = 0;
  int temperatureBme280HourAvg = 0;
  int lightSensorHourAvg = 0;
  int pressureBme280HourMin = 100000;
  int temperatureBme280HourMin = 1000;
  int temperatureBme280HourMax = -1000;
  int counterLoop = counterHour;
  for(int i=0;i&lt;counterLoop;i++) {
    lightSensorHourAvg += lightSensorHour[i];
    pressureBme280HourAvg += pressureBme280Hour[i];
    temperatureBme280HourAvg += temperatureBme280Hour[i];
    temperatureBme280HourMax= max(temperatureBme280HourMax,temperatureBme280Hour[i]);
    pressureBme280HourMin = min(pressureBme280HourMin,pressureBme280Hour[i]);
    temperatureBme280HourMin = min(temperatureBme280HourMin,temperatureBme280Hour[i]);
    humidityBme280HourAvg += humidityBme280Hour[i]; 
  }
  pressureBme280HourAvg = pressureBme280HourAvg/counterLoop;
  temperatureBme280HourAvg = temperatureBme280HourAvg/counterLoop;
  lightSensorHourAvg = (int)lightSensorHourAvg/counterLoop;

  strcat(postStr, stationId);
  strcat(postStr,"&amp;3="); // chuva hora
  strcat(postStr, dtostrf(rainHour,6,2,charDummy));
  strcat(postStr,"&amp;8=");
  strcat(postStr, dtostrf(temperatureBme280HourAvg,6,2,charDummy));
  strcat(postStr,"&amp;9="); //temperature avg
  strcat(postStr, dtostrf(temperatureBme280HourAvg,6,2,charDummy));
  strcat(postStr,"&amp;10="); //temperature avg
  strcat(postStr, dtostrf(temperatureBme280HourMax,6,2,charDummy));
  strcat(postStr,"&amp;11="); //temperature avg
  strcat(postStr, dtostrf(temperatureBme280HourMin,6,2,charDummy));
  strcat(postStr,"&amp;20=");
  strcat(postStr, dtostrf(pressureBme280HourAvg,10,0,charDummy));
  strcat(postStr,"&amp;22=");
  strcat(postStr, dtostrf(pressureBme280HourMin,10,0,charDummy));
  strcat(postStr,"&amp;101=");
  strcat(postStr, dtostrf(lightSensorHourAvg,6,0,charDummy));
  strcat(postStr,"&amp;time=");
  strcat(postStr, dtostrf(unixtimeEvent,16,0,charDummy));
  strcat(postStr,"&amp;endline=1");
  strcat(postStr, "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n");
}
int rainCheck(Array8Int slaveData) {
  int pulseChange = slaveData.array[0];
  return pulseChange;
}
Fatal exception 9(LoadStoreAlignmentCause):


This is caused by you (or some code you are running) attempting to read or write a 32 bit value from memory that is not "aligned" to 32 bits.  It is most often the result of trying to cast portions of a byte array (for instance a buffer received over UDP) to a 32-bit integer.  The compiler is not clever enough to know that the byte array portion you are casting isn't at a 32-bit boundary and thus doesn't know to use the 8-bit load/store instructions to access the memory.

Mapping a struct over a buffer can also have similar issues where the buffer is 8-bit aligned and the struct contains 32-bit words. 

You can combat it by forcing the alignment of any buffers which you treat in such a way with the __attribute__((aligned(4)) tag:

uint8_t __attribute__((aligned(4))) buffer[128];


You can also "pack" structures to tell the compiler "These variables are mis-aligned and should not be padded to 32-bits":

struct foo {
    uint8_t bar1;
    uint32_t bar2;
} __attribute__((packed));


If in doubt, though, just pull individual bytes out of buffers (or wherever) and build up your larger integers manually with bit shifting and OR operators (&lt;&lt; and |), and do the reverse for filling byte buffers.